javascript how to specify number of digits code example
Example 1: javascript round to 2 digits
var num = 2;
var roundedString = num.toFixed(2);// 2.00
Example 2: get decimals from float javascript
js> 2.3 % 1
0.2999999999999998
var num = 2;
var roundedString = num.toFixed(2);// 2.00
js> 2.3 % 1
0.2999999999999998