相关疑难解决方法(0)

当启用use strict时,如何在JavaScript中找到调用函数?

use strict启用时是否可以看到函数的被调用者/调用者?

'use strict';

function jamie (){
    console.info(arguments.callee.caller.name);
    //this will output the below error
    //uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
};

function jiminyCricket (){
   jamie();
}

jiminyCricket ();
Run Code Online (Sandbox Code Playgroud)

javascript use-strict

41
推荐指数
4
解决办法
3万
查看次数

标签 统计

javascript ×1

use-strict ×1