Skip to content

Latest commit

 

History

History

fizz-buzz

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

FizzBuzz

Description

Fizz Buzz is a game in which you should incrementally count numbers, replacing any number divisible by 3 on 'Fizz' word, any number divisible by 5 on 'Buzz' word, and any number divisible both by 3 and 5 on 'FizzBuzz' word.

Implementation

fizzBuzz(num) should log in the console an array of numbers from 1 up to num according to the rules described above.

  • numbers divided by 3 should be replaced on 'Fizz' word.
  • numbers divided by 5 should be replaced on 'Buzz' word.
  • numbers divided by 3 and 5 should be replaced on 'FizzBuzz' word.

Example:

fizzBuzz(7)  //  [1, 2, "Fizz", 4, "Buzz", "Fizz", 7]