Created
December 22, 2018 07:09
-
-
Save tuckcodes/105a9413aca21171b70a7e67789809c1 to your computer and use it in GitHub Desktop.
Traditional fizz buzz but with a switch statement for fun
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
// FizzBuzz | |
// Good ol'fashioned fizz buzz | |
// Decided to use a switch statement to mix it up a little | |
for (let numStart = 0; numStart<100; numStart++) { | |
switch (true) { | |
case ((numStart>0) && (numStart%3 == 0)): | |
console.log("Fizz"); | |
break; | |
case ((numStart>0) && (numStart%5 == 0)): | |
console.log("Buzz"); | |
break; | |
default: | |
console.log(numStart); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment