可以混合使用严格和非严格代码。但即使调用不在严格代码中,也不能使用caller。有人知道任何解决方法吗?
我尝试过这个:
(function strict(){
"use strict";
nonStrict();//ok
nonStrictCaller();//error :(
})();
function nonStrict(){
return 011;//Octal literals are not allowed in strict mode
}
function nonStrictCaller(){
return nonStrictCaller.caller;
}
this
传递给函数,对吧? - gdoron