(3.141596).toFixed(2); // 3.14
var myNumber = 2;
myNumber.toFixed(2); //returns "2.00"
myNumber.toFixed(1); //returns "2.0"
(<number>).toFixed(<Number of decimal places required>);
Use toFixed to convert it to a string with some decimal places shaved off, and then convert it back to a number.
+(0.1 + 0.2).toFixed(12) // 0.3
It looks like IE's toFixed has some weird behavior, so if you need to support IE something like this might be better:
Math.round((0.1 + 0.2) * 1e12) / 1e12
const removedDecimal = Math.round(decimal);
// returns 5
var discount = Math.round((100 - (price / listprice) * 100) * 100) / 100;
const removedDecimal = Math.trunc(decimal);
// returns 5