Created
May 19, 2020 10:04
-
-
Save podanypepa/1f66012a9167bff9dc40b3d3b530106b to your computer and use it in GitHub Desktop.
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
function fizzBuzz() { | |
let a = ""; | |
let x, y; | |
for (let i = 1; i <= 100; i++) { | |
x = i % 3; | |
y = i % 5; | |
if (x && y) { | |
a += i + " "; | |
continue; | |
} else { | |
if (!x) { | |
a += "fiz"; | |
} | |
if (!y) { | |
a += "buzz"; | |
} | |
a += " "; | |
} | |
} | |
console.log(a); | |
} | |
fizzBuzz(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment