Last active
July 16, 2019 01:59
-
-
Save vladanyes/5cade2ca9011471d26674b5249294f20 to your computer and use it in GitHub Desktop.
JavaScript stack size check
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
// Each boolean and number variable takes 8 bytes of memory. | |
var counter = 0; | |
try { | |
function foo() { | |
counter += 1; | |
foo(); | |
} | |
foo(); | |
} catch(e) { | |
console.error(e); | |
console.log('counter =', counter); | |
} | |
// https://glebbahmutov.com/blog/javascript-stack-size/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment