Answer the question
In order to leave comments, you need to log in
How to round a fractional number to two decimal places in JS?
For example, we calculate like this:
And the result can be like this: 1456.914819423
How to round this number two two zeros after the decimal points?
var summ = toFloat(212,31) * toFloat(723,62);
Answer the question
In order to leave comments, you need to log in
+12.3456789.toFixed(2); //12.35
// можно сделать удобную функцию
function fix (num, n) {
return +num.toFixed(n);
}
fix(12.3456789, 2); // 12.35
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question