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)+\"
parseInt is faster then Math.floor
function floorFigure(figure, decimals){ if (!decimals) decimals = 2; var d = Math.pow(10,decimals); return (parseInt(figure*d)/d).toFixed(decimals); }; floorFigure(123.5999) => "123.59" floorFigure(123.5999, 3) => "123.599"