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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -