Ad
Code
Diff
  • export function fizzBuzz(input: number): string {
        const output = (input % 3 ? "" : "Fizz") + (input % 5 ? "" : "Buzz");
        return output.length ? output : input.toString();
    }
    • export function fizzBuzz(input: number): string {
    • const output: string = `${input % 3 === 0 ? "Fizz" : ""}${input % 5 === 0 ? "Buzz" : ""}`;
    • return output.length > 0 ? output : input.toString(10);
    • const output = (input % 3 ? "" : "Fizz") + (input % 5 ? "" : "Buzz");
    • return output.length ? output : input.toString();
    • }