Created
May 19, 2010 14:38
-
-
Save dsimard/406362 to your computer and use it in GitHub Desktop.
recursive count to 10 with named functions
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 countToTen(i) { | |
| if (i <= 10) { | |
| console.log(i); | |
| countToTen(i+1); // You can cleanly call the named function | |
| } | |
| } | |
| count(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment