Javascript SetInterval With Context Posted by jQueryIsAwesome on Friday November 11, 2011 @04:09PM from the javascriptisawesome.blogspot.com dept. http://javascriptisawesome.blogspot.com/2011/11/setinterval-with-context.html ( 1 comment | 3 points | on HN )
If at call time it is being called on an object, it will have the value of that object. Otherwise it will have the value of window.
What is happening here is that the setTimeout() calls the lambda at some later point, and it's no longer in the context of the object.An alternate fix for the issue would be:
An article on the subject (that also talks about call and apply): http://www.robertsosinski.com/2009/04/28/binding-scope-in-ja...