Introduction
What is JSDoc?
JSDoc is an API documentation generator for JavaScript. You embed documentation comments directly in your source code — right next to the code they describe — and JSDoc scans those comments to produce a complete HTML documentation website.
The core idea is simple: a specially-formatted comment block above any symbol tells JSDoc everything it needs to know about that symbol.
/**
* Adds two numbers together.
* @param {number} a - The first operand.
* @param {number} b - The second operand.
* @returns {number} The sum of a and b.
*/
function add(a, b) {
return a + b;
}
Run JSDoc on that file and you get a ready-to-publish documentation site — no extra tooling required.
Core concepts
@param, @returns, @type, and 60+ other tags that describe your code.
{@link} and {@tutorial} — used inside descriptions to create hyperlinks.
How to document ES2015 classes, modules, and complex type relationships.
Tune JSDoc's behaviour with a JSON or JS configuration file.
How JSDoc comments work
Every JSDoc comment starts with /** (two stars after the slash) and ends with */. Comments that begin with /* or /*** (three or more stars) are ignored — a deliberate escape hatch to suppress blocks you don't want documented.
/** This comment IS parsed by JSDoc. */
/* This comment is NOT parsed. */
/*** This comment is NOT parsed either. */
Inside the comment block, the first block of free text before any tags becomes the description. Tags begin with @ and may include a type (in {curly braces}), a name, and further description text.
What JSDoc produces
By default JSDoc generates static HTML using its built-in default template. The output is fully self-contained — no server required. You can:
- Host it on GitHub Pages, Netlify, or any static host.
- Swap in a custom template or a community template for a different look.
- Integrate JSDoc into your build pipeline (
npm run docs).
Next steps
- Install JSDoc
Get JSDoc into your project via npm. Installation →
- Write your first comment
Learn the comment syntax and run JSDoc for the first time. Quickstart →
- Explore every tag
Browse the complete tag reference. Tags →
Official reference: Official JSDoc documentation