toFixed() Method – How to Fix the Number of Decimal Digits
toFixed() specifies the number of digits browsers should show after a number’s decimal point.
Syntax of the toFixed() Method
toFixed() accepts only one optional argument. Here is the syntax:
The totalFractionDigits argument specifies the number of digits browsers should show after the number’s decimal point. If omitted, browsers will use 0—which means it will add no digits after the decimal point.