Last active
March 21, 2020 11:32
-
-
Save Megafry/ea39cfd7752888c6458571e544b58fdc to your computer and use it in GitHub Desktop.
FizzBuzz challenge
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
const numberOfLoops = 100 | |
const numbersToReplace = [ [3,'Fizz'], [5,'Buzz'] ] | |
for(i=1;i<=numberOfLoops;i++){ | |
r = numbersToReplace.filter( replacement => !(i % replacement[0])) | |
console.log( r.length ? r.map(result => result[1]).join('') : i ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment