function main() { Hello(); } function Hello() { // How do you find out the caller function is \'main\'? }
Is there a way to find out the call
here is a function to get full stacktrace:
function stacktrace() { var f = stacktrace; var stack = 'Stack trace:'; while (f) { stack += '\n' + f.name; f = f.caller; } return stack; }