Javascript Help with reading floats

SpomaMewor

Member
May 31, 2002
71
0
0
I am writing a javascript application to do some nmerical conversions. I am farely new to Javascript so I could use some help. I have a variable that will equal a number that may or may not contain a "." so it could have a value of something like 23.4567 or 23. I need to be able to limit the value so that it only goes out to 2 decimal points and then I need to be able to separate the value by the decimal point.

ie... if it is a vlaue of 23.4567 I need to be able to pull the 23 and save it to a variable and then take the .4567 an save this to a variable. I could use some help with this.
Currently I am using ParseInt() to get the value of 23 but I don't know how to bring out the decimal portion.

thanks for the help
 

Odoacer

Senior member
Jun 30, 2001
809
0
0
I know there's a Math.round() function but i dont know if you can specify a number of decimal places, i.e. Math.round(2) for two decimal places.