setTimeout(this.doAnimation, 1000) will fail if it is defined in aclass definition

  • Thread starter liketofindoutwhy
  • Start date
J

Jorge

"Literally" is merely emphasizing the fact that it does not need to be a
variable in ECMAScript implementations:

<http://en.wikipedia.org/wiki/Closure_(programming)>

Shorter, clearer, easier to understand, in a word : (Mmmuch) better,
explanation:

Closure

Functions can be defined inside of other functions. The inner function
has access to the vars and parameters of the outer function. If a
reference to an inner function survives (for example, as a callback
function), the outer function's vars also survive.

http://javascript.crockford.com/survey.html

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top