Skip to content

Instantly share code, notes, and snippets.

@LB-Digital
Last active December 12, 2018 22:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LB-Digital/d37e0106c86a7b8e180aed5935cfd1ec to your computer and use it in GitHub Desktop.
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
/** 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