js format a number to have two decimals code example
Example 1: js number 2 decimal places
(3.141596).toFixed(2); // 3.14
Example 2: to 2 decimal places javascript
var discount = Math.round((100 - (price / listprice) * 100) * 100) / 100;
(3.141596).toFixed(2); // 3.14
var discount = Math.round((100 - (price / listprice) * 100) * 100) / 100;