Can I get the name of the currently running function in JavaScript?

問題:

Is it possible to do this:是否有可能做到這一點:

myfile.js:
function foo() {
    alert(<my-function-name>);
    // pops-up "foo"
    // or even better: "myfile.js : foo"
}

I've got the Dojo and jQuery frameworks in my stack, so if either of those make it easier, they're available.我的堆棧中有 Dojo 和 jQuery 框架,所以如果它們中的任何一個使它更容易,它們都可用。


解決方案:

參考一: https://en.stackoom.com/question/4FaZ
參考二: https://stackoom.com/question/4FaZ
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章