Difficulty:
FizzBuzz is the "Hello World" of technical interview questions. Your function should write the numbers from 1 to
n
with a twist; instead of any multiplier of 3, you outputFizz
, instead of multiplers of 5 you outputBuzz
, and if they happen at the same time, you should useFizzBuzz
. The output of your function should be a mixed array of numbers and strings.
fizzbuzz(20);
[ 1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz", 11, "Fizz", 13, 14, "FizzBuzz", 16, 17, "Fizz", 19, "Buzz" ]