var arrayfunc = [function(){return this;}];
var func = arrayfunc[0];
arrayfunc[0](); //[function (){return this;}]
func(); //Window
i don’t know why this is not same? Do you help me ?
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.
Just think as below:
Even through
arrayfunc[0] === funcreturn true, the caller is different.arrayfunc[0]();called the function through the objectarrayfunc,window['func']();called the function through the objectwindow.