Javascript this points to Window object
Posted
by terrani
on Stack Overflow
See other posts from Stack Overflow
or by terrani
Published on 2010-04-27T08:11:11Z
Indexed on
2010/04/27
8:13 UTC
Read the original article
Hit count: 140
JavaScript
|this
Hi,
I have the following code. I expected to see "archive" object on my firebug console, but I see Window object. Is it normal?
var archive = function(){}
archive.prototype.action = {
test: function(callback){
callback();
},
test2: function(){
console.log(this);
}
}
var oArchive = new archive();
oArchive.action.test(oArchive.action.test2);
© Stack Overflow or respective owner