Last active
August 27, 2023 21:45
-
-
Save AlexFBP/6495be375e24fcce258193ddcde78374 to your computer and use it in GitHub Desktop.
Codigos random...
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 numbers 1-100 | |
// If divisible by "3", print "Fizz" | |
// If divisible by "5", print "Buzz" | |
// Otherwise, print the number | |
for (let i = 1; i < 100; i++) { | |
let t = ""; | |
if (!(i%3)) { | |
t = "Fizz"; | |
} | |
if (!(i%5)) { | |
t += "Buzz"; | |
} | |
// console.log(`${i}-${t}`); | |
console.log(t?t:i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment