Created
April 24, 2014 16:46
-
-
Save qgustavor/11261348 to your computer and use it in GitHub Desktop.
Browser recursion test
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
/** Get the maximum call stack and the error it generates */ | |
(function () { | |
var results = {}; | |
(function f (a) { | |
try { | |
f(a+1); | |
} catch (e) { | |
results[a] = e; | |
} | |
}(0)); | |
console.log(Object.keys(results).map(function(e){ | |
return e + ' [' + results[e].constructor.name+']: ' + results[e].message; | |
})[0]); | |
}()); | |
/* RESULTS */ | |
// Firefox/22.0 -> 7048 [InternalError]: too much recursion | |
// varies from 6973 up to 7048 | |
// Chrome/35.0.1916.69 -> 9648 [RangeError]: Maximum call stack size exceeded | |
// Internet Explorer 11 -> 12601 [undefined]: Out of stack space | |
// varies from 6243 up to 12601 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment