JavaScript: toFixed() method
by redoak2000
JavaScript
var i = 50;
var sum = 6 + 4;
var y = 1.50;
var total = (i + y) - sum;
console.log(total.toFixed(2));
total = 1.255001;
console.log(total.toFixed(2));
total = 1.254;
console.log(total.toFixed(2));
total = 1.256;
console.log(total.toFixed(2));
total = 1.255*100/100;
console.log(total.toFixed(2));