toFixed()

Using the toFixed() method will display a float with the number of decimal places that you specify. In the example below, we have a number with 4 decimal places and we change it to 2 decimal places.

number = 4.5678;
 number = number.toFixed(2);