Last active
June 19, 2022 18:28
-
-
Save doxyf/72b89cabc3dfc8af12a0cc70d2eacc45 to your computer and use it in GitHub Desktop.
The FizzBuzz thing in JavaScript
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
for (let i = 1; i <= 100; i++) { | |
console.log(fizzBuzz(i)); | |
}; | |
function fizzBuzz(num){ | |
if(num % 5 == 0 && num % 3 == 0) return 'FizzBuzz'; | |
if(num % 3 == 0) return 'Fizz' | |
if(num % 5 == 0) return 'Buzz' | |
return num; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment