Created
May 25, 2016 16:41
-
-
Save bhalash/17b1bf57b5cb8fa78fbaae45f78fcc14 to your computer and use it in GitHub Desktop.
Recursive JavaScript Fizzbuzz
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 fizzbuzz(number, max) { | |
| var fizz = ''; | |
| number = number || 1; | |
| max = max || 100; | |
| if (!(number % 5)) { | |
| fizz += 'fizz'; | |
| } | |
| if (!(number % 3)) { | |
| fizz += 'buzz'; | |
| } | |
| console.log(number, fizz); | |
| if (number < max) { | |
| fizzbuzz(++number, max); | |
| } | |
| })(null, 200); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment