• Register
3,890 points
11 5 1
Welcome to Kodlogs, programming questions and answer website.

The toFixed number in javascript is used for number formatting by using fixed-point notation. This can be used to format a number with a specific number of digits to the right side of the decimal.




The number of digits that appear after the decimal point: These numbers have a value between 0 and 20 inclusive and this implementation can support a wide range of values. It will be treated as 0 if this argument is removed.

Return Value:

It will return a string representation of the given number by using the fixed point notation.


If this method is invoked on an object then it is not a number.


This method will return a string representation of numObj that does not use exponential notations and must have the same digits after decimal places. The numbers are rounded if necessary. The fractional part is padding with zeros if required that have specified length. If the absolute value of numObj is greater than or equal to 1e+21, then this method simply calls Number.prototype.toString() and returns a string in exponential notations.


Floating point numbers cannot represent all decimals precisely in binary. This can lead to unexpected result like 0.1+0.2 === 0.3 that will return false.

3,890 points
11 5 1