Skip to content

Instantly share code, notes, and snippets.

@arayi
Created March 4, 2014 00:02
Show Gist options
  • Save arayi/9337355 to your computer and use it in GitHub Desktop.
Save arayi/9337355 to your computer and use it in GitHub Desktop.
var fizzBuzz = function(max) {
if (max == 2) { return "Shiny JS Recursive FizzBuzz! :D\n" }
else if (max % 15 === 0) { return fizzBuzz(max - 1) + "\nFizzBuzz" }
else if (max % 5 === 0) { return fizzBuzz(max - 1) + "\nBuzz" }
else if (max % 3 === 0) { return fizzBuzz(max - 1) + "\nFizz" }
else { return fizzBuzz(max-1) + "\n" + max.toString() }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment