JavaScript Number toFixed()
JavaScript Number toFixed()
The toFixed() method is used to convert a number to a string. It rounds the string to a specific number of decimals.
Syntax:-
Its syntax is:- number.toFixed(x)
Return:-
Its return is:- a string representation of numbers with/without decimal
Further Explanation:-
Parameter | Description |
x | Optional. The number of decimals. |