Suppose I have a obj called myObj and it has a function test
MyObj.prototype.test = function(){
alert(this);
}
And I set the timer:
setInteravl(myObj.test,1000);
As this depends entirely on how you called the function, this refers to window instead of myObj in the alert statement
What should I do if I need the myObj reference instead?
Wrap it in an anonymous function:
Or in modern implementations,
bindit.