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

797 B

id, title, challengeType, dashedName
id title challengeType dashedName
681cb1b0dab50c87ddb2e519 Challenge 8: Factorializer 28 challenge-8

--description--

Given an integer from zero to 20, return the factorial of that number. The factorial of a number is the product of all the numbers between 1 and the given number.

  • The factorial of zero is 1.

--hints--

factorial(0) should return 1.

assert.equal(factorial(0), 1);

factorial(5) should return 120.

assert.equal(factorial(5), 120);

factorial(20) should return 2432902008176640000.

assert.equal(factorial(20), 2432902008176640000);

--seed--

--seed-contents--

function factorial(n) {

  return n;
}

--solutions--

function factorial(n) {
  return n == 0 ? 1 : n * factorial(n - 1);
}