Skip to main content

@default

Syntax

@default
@default value

Overview

@default documents the default value of a symbol. When the symbol is assigned a literal value in the source code, JSDoc can infer and record it automatically. You can also provide the value explicitly in the tag.

Examples

Inferred default

/**
* The default timeout in milliseconds.
* @type {number}
* @default
*/
const TIMEOUT = 3000;

JSDoc records 3000 as the default value automatically.

Explicit default

/**
* @param {string} [locale='en-US'] - The locale string.
* @default 'en-US'
*/
function formatDate(date, locale = 'en-US') {}

See also

Official reference: jsdoc.app/tags-default