@example
Tag type: block tag
TSDoc standardization: extended
Indicates a documentation section that should be presented as an example illustrating how to use the API. It may include a code sample.
Usage example:
/**
* Adds two numbers together.
*
* @remarks
* Use this function to perform example addition.
*
* @example
* Here's a simple example:
* ```
* // Prints "2":
* console.log(add(1,1));
* ```
*
* @example
* Here's an example with negative numbers:
* ```
* // Prints "0":
* console.log(add(1,-1));
* ```
*
* @param x - the first number to add
* @param y - the second number to add
* @public
*/
export function add(x: number, y: number): number {
return x + y;
}
API Documenter will number the example sections automatically. The output might look like this:
add() functionAdds two numbers together.
Signature:export declare function add(x: number, y: number): number;
ParametersReturns:
Parameter Type Description x number
the first number to add y number
the second number to add
number
RemarksUse this function to perform example addition.
Example 1Here's a simple example:
// Prints "2":
console.log(add(1,1));Example 2Here's an example with negative numbers:
// Prints "0":
console.log(add(1,-1));