Created
May 19, 2010 14:36
-
-
Save dsimard/406360 to your computer and use it in GitHub Desktop.
recursive count to 10 anonymous
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 count = function(i) { | |
| if (i <= 10) { | |
| console.log(i); | |
| arguments.callee(i+1); // this will throw an error on ECMAScript 5 strict | |
| } | |
| } | |
| count(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment