Skip to content

Instantly share code, notes, and snippets.

@mejiaro
Created February 17, 2016 21:38
Show Gist options
  • Save mejiaro/d92f060e2cc7387af58c to your computer and use it in GitHub Desktop.
Save mejiaro/d92f060e2cc7387af58c to your computer and use it in GitHub Desktop.
JS FizzBuzz
for (number = 1; number < 101; number++)
switch(true) {
case number % 3 == 0 && number % 5 == 0:
console.log("FizzBuzz");
break;
case number % 3 == 0:
console.log("Fizz");
break;
case number % 5 == 0:
console.log("Buzz");
break;
default:
console.log(number)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment