toFixed
The toFixed() method formats a number using fixed-point notation with a specified number of decimals. It returns a string representation of the number.
Interactive example
Syntax
Classic signature
typescript
function toFixed<
GenericInput extends number
>(
input: GenericInput,
digits: number
): stringCurried signature
typescript
function toFixed<
GenericInput extends number
>(
digits: number
): (input: GenericInput) => stringParameters
input: The number to format (classic signature only).digits: The number of digits after the decimal point (between 0 and 100).
Return value
returns a string representing the number with the specified number of decimals.
