function main() { Hello(); } function Hello() { // How do you find out the caller function is \'main\'? }
Is there a way to find out the call
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: Just drop the debugger where you want to investigate the stack.