Skip to main content

Write a program that prints (to STDOUT) 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.

The goal is to write the shortest code possible.

//
// Shortest Fizz Buzz
//
// Write a program that prints (to STDOUT) 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".
//
// The goal is to write the shortest code possible.
//
// Expected output:
//   http://cdn.hackerrank.com/fizzbuzz.txt
//
//   Your output should exactly match the above.
//
// Source
//   https://www.hackerrank.com/challenges/fizzbuzz
//

for (i = 0; ++i < 101;) console.log((i % 3 ? '' : 'Fizz') + (i % 5 ? '' : 'Buzz') || i)