Created
January 17, 2024 09:42
-
-
Save immkavin-ranks/4ff1356ff5290ae831f785e7cb279713 to your computer and use it in GitHub Desktop.
Updated fizzBuzz
This file contains 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
var output = [] | |
var count = 1; | |
function fizzBuzz() { | |
while (count <= 100) { | |
if (count % 3 === 0) { | |
if (count % 5 === 0) { | |
output.push("FizzBuzz") | |
} else { | |
output.push("Fizz"); | |
} | |
} else if (count % 5 === 0) { | |
output.push("Buzz"); | |
} else { | |
output.push(count); | |
} | |
count++; | |
} | |
console.log(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment