如何在JavaScript中找到调用者函数?function main(){
Hello();}function Hello(){
// How do you find out the caller function is 'main'?}有办法找出调用堆栈吗?
3 回答
慕标琳琳
TA贡献1830条经验 获得超9个赞
function Hello() { alert("caller is " + arguments.callee.caller.toString());}
function Hello() { alert("caller is " + Hello.caller.toString());}
添加回答
举报
0/150
提交
取消