Skip to main content

Code Golf · #7 · 2026-04-11

FizzBuzz (single number)

Difficulty 2/3 · JavaScript

How to play

Write a JavaScript function body that passes all test cases using the fewest characters. Run against examples first, then submit for the full test suite. Eagle < Birdie < Par.

Given a number, return "Fizz" if divisible by 3, "Buzz" if by 5, "FizzBuzz" if by both, otherwise the number as a string.

Examples

f(15) FizzBuzz
f(3) Fizz
f(5) Buzz
f(7) 7

Loading your progress...

Your code (function body — receives input)

function(input) { 0 chars
}

Write the shortest JavaScript function body that passes all tests · Back to hub