How do you find out the caller function in JavaScript when use strict is enabled?

后端 未结 5 1439
谎友^
谎友^ 2020-12-01 04:53

Is it possible to see the callee/caller of a function when use strict is enabled?

5条回答
  •  旧巷少年郎
    2020-12-01 05:36

    You can get a stack trace using:

    console.trace()
    

    but this is likely not useful if you need to do something with the caller.

    See https://developer.mozilla.org/en-US/docs/Web/API/Console/trace

提交回复
热议问题