If I have the following code:
var obj = {
x: 34,
init: function() {
alert(this.x);
alert(obj.x)
}
};
Both al
this inside the function is not necessarily the same as obj. It depends on how the function is called.
obj.init(), obj will be the same as this.setTimeout(obj.init, 500), this will be the global object (window in browsers, unless you're using strict mode) Good MDN reference on all of this