Last active
December 12, 2018 22:31
-
-
Save LB-Digital/d37e0106c86a7b8e180aed5935cfd1ec to your computer and use it in GitHub Desktop.
My attempt at the classic FizzBuzz challenge, with an aim of being as concise as possible
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
/** FizzBuzz challenge in 3 lines | |
* "Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”." | |
*/ | |
for (let i=1; i<=100; i++){ | |
console.log((((i%3==0)?'Fizz':'')+((i%5==0)?'Buzz':''))||i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment