Created
June 14, 2012 18:12
-
-
Save aheckmann/2931898 to your computer and use it in GitHub Desktop.
fake stack overflow
This file contains hidden or 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
var times = 0; | |
function loop () { | |
++times; | |
if (times >= 30000) throw new Error('fake stack overflow'); | |
return loop; | |
} | |
function start () { | |
var fn; | |
while (fn = loop()) fn(); | |
console.log('looped %d times', times); | |
} | |
start(); | |
// Error: fake stack overflow | |
// at loop (repl:1:52) | |
// at start (repl:1:41) | |
// at repl:1:1 | |
// at REPLServer.eval (repl.js:80:21) | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment