Loading ...
Sorry, an error occurred while loading the content.

39Re: Functions and loops

Expand Messages
  • Douglas Crockford
    May 11, 2008
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Alan Green" <alan.green.mail@...>
      wrote:
      >
      > Hi
      > Although this is really a javascript (not jslint) issue, could you
      > explain why one should make the function valus in a closure.
      > Thanks
      > Alan

      The common failure case was shown in the example, attaching event
      handlers in a loop. If the event handlers are bound to variables that
      are mutated by the loop, then they are likely to work incorrectly.
    • Show all 3 messages in this topic