Javascript rond décimal 2 chiffres
var numb = 123.23454;
numb = numb.toFixed(2);
Strange Snake
var numb = 123.23454;
numb = numb.toFixed(2);
Math.round((num + Number.EPSILON) * 100) / 100
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2");
}
console.log(roundToTwo(2.005));
Number((2.935).toFixed(2)) //2.94
Number((12.349345).toFixed(4)) //12.2493
Number((2.5398).toFixed(3)) //2.540
Number((1.005).toFixed(2)) //outputs 1 instead of 1.01
Number((1.555).toFixed(2)) //outputs 1.55 instead of 1.56
var numb= 212421434.533423131231;
var rounded = Math.round((numb + Number.EPSILON) * 100) / 100;
console.log(rounded);