Created
January 26, 2019 13:34
-
-
Save anuraagdjain/f3f34485523e520e98aca4771a1ddc2d to your computer and use it in GitHub Desktop.
FizzBuzz in JS
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
| "use strict"; | |
| const fizzBuzz = () => { | |
| for (let i = 1; i <= 100; i++) { | |
| const mod5 = i % 5, | |
| mod3 = i % 3; | |
| if (mod3 === 0 && mod5 === 0) console.log("FizzBuzz"); | |
| else if (mod3 === 0) console.log("Fizz"); | |
| else if (mod5 === 0) console.log("Buzz"); | |
| else console.log(i); | |
| } | |
| }; | |
| fizzBuzz(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment