Suppose I have a value of 15.7784514, I want to display it 15.77 with no rounding.
var num = parseFloat(15.7784514); document.write(num.toFixed(1)+\"
The most efficient solution (for 2 fraction digits) is to subtract 0.005 before calling toFixed()
toFixed()
function toFixed2( num ) { return (num-0.005).toFixed(2) }
Negative numbers will be rounded down too (away from zero). The OP didn't tell anything about negative numbers.