var mC = function(map){
var init = function(iMap){
alert("Init " + this + " with");
}
init(map);
};
var m = new mC({});
why i am getting value of this as [object window]? Is it a window object??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes! Because
initis a variable ofmC, it will share its scope (which currently is the global scope, which is also thewindowobject).However. If you changed to the following:
Then
thisinsideinitwould be a reference to your instance.