Created
March 14, 2012 04:02
-
-
Save codylindley/2033972 to your computer and use it in GitHub Desktop.
Find limit of recursion
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
var recurse = function(depth){ | |
try{ | |
return recurse(depth + 1); | |
}catch(ex){ | |
return depth; | |
} | |
}; | |
console.log(recurse(1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ha, I have some similar code in my LayoutManager Backbone plugin: