How do you find out the caller function in JavaScript?

前端 未结 30 1489
粉色の甜心
粉色の甜心 2020-11-21 17:46
function main()
{
   Hello();
}

function Hello()
{
  // How do you find out the caller function is \'main\'?
}

Is there a way to find out the call

30条回答
  •  感情败类
    2020-11-21 18:09

    I know you mentioned "in Javascript", but if the purpose is debugging, I think it's easier to just use your browser's developer tools. This is how it looks in Chrome: enter image description here Just drop the debugger where you want to investigate the stack.

提交回复
热议问题