EXERCISE · AlgoCasts

FizzBuzz

Write a program that console logs the numbers from 1 to n. But for multiples of three print “fizz” instead of the number and for the multiples of five print “buzz”.

3 testsAlgoCastsGPL-3.0exercise 05 of 26

Directions

Directions

Write a program that console logs the numbers from 1 to n. 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”.

Examples#

JS
fizzBuzz(5);12fizz4buzz

Try it first#

Copy the stub, make the 3 tests pass on your machine, then open the solution. The reveal is remembered per page in this browser.

JSexercises/fizzbuzz/index.js
function fizzBuzz(n) {} module.exports = fizzBuzz;

See also