truncate number to 2 decimal places javascript code example
Example 1: javascript convert to two decimal places
var example = 3.35464464374256 ;
example = parseFloat(example.toFixed(2)) ; // example == 3.35
Example 2: to 2 decimal places javascript
var discount = Math.round((100 - (price / listprice) * 100) * 100) / 100;