Number.to_fixed

Number.to_fixed

Number.to_fixed

Function

Format a number to specified decimal places.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
digitsIntNo0Number of decimal places; negative numbers are treated as 0.

Return value

TypeDescription
StringReturns a string with fixed decimal places.

Example

Notes

  • The result is a string, not a number.