Created
February 13, 2014 09:25
-
-
Save greycode/8972213 to your computer and use it in GitHub Desktop.
打印 JavaScript 函数调用堆栈
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 打印 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