Created
January 25, 2012 06:05
-
-
Save ynonp/1675017 to your computer and use it in GitHub Desktop.
js intro
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
function Counter(max) { | |
var val = 0; | |
return function() { return (val < max) ? val++ : false; } ; | |
} | |
var c = Counter(10); | |
while (c()) { | |
console.log(c()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment