Interview Question:
Write a short program that prints each number from 0 to 100 on a new line.
For each multiple of 3, print "Fizz" instead of the number.
For each multiple of 5, print "Buzz" instead of the number.
For numbers which are multiples of both 3 and 5, print "FizzBuzz" instead of the number.
Solution 1:
Solution 2:
Comment below your approach!
Top comments (5)
prints each number from 1 to 100 - then why your loop starts at 0?
Typo @zohar ++
Looks like I solved this problem a few months back on Hacker rank or somewhere
How the heck !!!!!!!
Javascript is a weakly typed language, so
'' || i
is basically translated toi
because''
is implicitly converted to false.