Answers for "javascript round without math"

21

rounding off in javascript

var avg=10.55;
console.log(Math.round(avg)); //Prints 11
Posted by: Guest on May-08-2020
0

javascript decimals without rounding

function getFlooredFixed(v, d) {
    return (Math.floor(v * Math.pow(10, d)) / Math.pow(10, d)).toFixed(d);
}

var x = 2.305185185185195;

document.write(getFlooredFixed(x, 5));
Posted by: Guest on December-17-2021

Code answers related to "javascript round without math"

Code answers related to "Javascript"

Browse Popular Code Answers by Language