FIZZBUZZ · SPEC

Write a function that returns strings for the numbers from 1 to n:

  • · Multiples of 3 → "Fizz"
  • · Multiples of 5 → "Buzz"
  • · Multiples of both → "FizzBuzz"
IMPLEMENTATION TO REVIEW
1function fizzBuzz(n: number): string[] {
2  return Array.from({ length: n }, (_, i) => {
3    if (i % 3 === 0) return "Fizz";
4    if (i % 5 === 0) return "Buzz";
5    if (i % 15 === 0) return "FizzBuzz";
6    return String(i);
7  });
8}