Skip to content

Instantly share code, notes, and snippets.

@starmer
Created January 14, 2011 19:20
Show Gist options
  • Select an option

  • Save starmer/780074 to your computer and use it in GitHub Desktop.

Select an option

Save starmer/780074 to your computer and use it in GitHub Desktop.
Print JavaScript Call Stack
//from http://eriwen.com/javascript/js-stack-trace/
var currentFunction = arguments.callee.caller;
while (currentFunction) {
console.log(currentFunction);
var fn = currentFunction.toString();
var fname = fn.substring(fn.indexOf('function') + 8, fn.indexOf('')) || 'anonymous';
//console.log(fn);
currentFunction = currentFunction.caller;
}
@akshayjai1

Copy link
Copy Markdown

does any one know how to use this snippet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment