开发者

Find the function calling the function in JS?

What's the best way to find the function that's calling the function?

For example, if I have

function fir开发者_运维问答st(){
  doSomething();
}

// Lots of code

function doSomething(){
  alert('Somehow, I know that' + ________ + 'function called me...');
  alert('Boink, hit an error, but now you know what function called me');
}

Is there any way to get that calling function? Thanks!


Replace ______ with doSomething.caller.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜