I used below two methods :
Number.prototype.myRound = function (decimalPlaces) { var multiplier = Math.pow(10, decimalPlaces); return (Math.round(th
In my software I use this:
(require DecimalJS)
Number.prototype.toFixed = function(fixed) { return (new Decimal(Number(this))).toFixed(parseFloat(fixed) || 0); }; var x = 1.005; console.log( x.toFixed(2) ); //1.01