Skip to content

Resource · Guide or article

Factorial

Defines the factorial of a non-negative integer and lists values from 0! to 15!. Useful as a first recursion exercise and as a reminder of how fast the values grow.

Reviewed

Open the original: Factorial (opens the original site in a new tab)

Add to a roadmap

Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.

Source content: English

Read this in other languages: 简体中文, Français, Türkçe, ქართული, Українська. In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example:

PrepKit overview

PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.

Suited to
The source does not state a level
Format
Reference

What it covers

  • Definition with the example 5! = 120
  • A lookup table of n! for n from 0 to 15, ending at 1 307 674 368 000

How to use it

PrepKit study advice, not a claim made by the source.

Write recursive and iterative versions, check them against the table, and find the first n where a JavaScript number loses exactness. Then switch to BigInt and explain the change.

Scope and limitations

Definition and table only: no algorithm discussion, complexity, overflow warning or code walkthrough. The only reference is Wikipedia.

Access and format

Free English README on GitHub in the MIT-licensed trekhleb/javascript-algorithms repository.

Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88

Evidence behind this overview
  • src/algorithms/math/factorial/README.md

Pages that include this

Get the PrepKit newsletter

Optional. You don't need it to use PrepKit.

How we handle your email