SyntaxFix
Write A Post
Hire A Developer
Questions
Here's a simple one
function roundFloat(num,dec){ var d = 1; for (var i=0; i<dec; i++){ d += "0"; } return Math.round(num * d) / d; }
Use like alert(roundFloat(1.79209243929,4));
alert(roundFloat(1.79209243929,4));
Jsfiddle