Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.2 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
696655d24b614176d4c9b78c Challenge 169: FizzBuzz Mini 28 challenge-169

--description--

Given an integer, return a string based on the following rules:

  • If the number is divisible by 3, return "Fizz".
  • If the number is divisible by 5, return "Buzz".
  • If the number is divisible by both 3 and 5, return "FizzBuzz".
  • Otherwise, return the given number as a string.

--hints--

fizzBuzzMini(3) should return "Fizz".

assert.equal(fizzBuzzMini(3), "Fizz");

fizzBuzzMini(4) should return "4".

assert.strictEqual(fizzBuzzMini(4), "4");

fizzBuzzMini(35) should return "Buzz".

assert.equal(fizzBuzzMini(35), "Buzz");

fizzBuzzMini(75) should return "FizzBuzz".

assert.equal(fizzBuzzMini(75), "FizzBuzz");

fizzBuzzMini(98) should return "98".

assert.strictEqual(fizzBuzzMini(98), "98");

--seed--

--seed-contents--

function fizzBuzzMini(n) {

  return n;
}

--solutions--

function fizzBuzzMini(n) {
  if (n % 3 === 0 && n % 5 === 0) return "FizzBuzz";
  if (n % 3 === 0) return "Fizz";
  if (n % 5 === 0) return "Buzz";
  return String(n);
}