Skip to content

Instantly share code, notes, and snippets.

@zjhiphop
Created November 21, 2014 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zjhiphop/ae51074aff770a42cf7f to your computer and use it in GitHub Desktop.
Save zjhiphop/ae51074aff770a42cf7f to your computer and use it in GitHub Desktop.
callstack.js
/*
* 打印 JavaScript 函数调用堆栈
*/
function printCallStack() {
var i = 0;
var fun = arguments.callee;
do {
fun = fun.arguments.callee.caller;
console.log(++i + ': ' + fun);
} while (fun);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment