Number.toFixed() — format a number using fixed-point notation
The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. If this argument is omitted, it is treated as 0.
A string representation of
that does not use exponential notation and has exactly
digits digits after the decimal place.
The number is rounded if necessary, and the fractional part is
padded with zeros if necessary so that it has the specified
number is greater than
1e+21, this method simply calls
Number.toString() and returns a string
in exponential notation.
digitsis too small or too large. Values between 0 and 20, inclusive, will not cause a RangeError. Implementations are allowed to support larger and smaller values as well.
If this method is invoked on an object that is not a Number.
// Returns 12346: note rounding, no fractional part
// Returns 12345.7: note rounding
// Returns 12345.678900: note added zeros
// Returns 123000000000000000000.00
// Returns 0.00