1var myNumber=12.2345;
2var myNumberWithTwoDecimalPlaces=parseFloat(myNumber).toFixed(2); //12.23
1decimal.toFixed();
2// return 6
3
4decimal.toFixed(2)
5// returns 5.68
6
7decimal.toFixed(1)
8// return 5.7
1var myNumber = 2;
2
3myNumber.toFixed(2); //returns "2.00"
4myNumber.toFixed(1); //returns "2.0"