javascript - How as a round number? -
i need round 2 number after comma. example
5000.0000 5000
5000.123 5000.12
5000.136 5000.13
how this?
i need function x.tofixed(2); if @ end of 2 zero, should not show
you can use javascript function round number
function roundnumber(rnum, rlength) { var newnumber = math.round(rnum*math.pow(10,rlength))/math.pow(10,rlength); return parsefloat(newnumber); } var num = roundnumber(5000.0000,0); //will return 5000
Comments
Post a Comment