Click to See Complete Forum and Search --> : How to convert a string into integer


mayordc
07-31-2003, 04:28 AM
How can I convert a string containing numeric value into integer to enable mathematical operations like addition specially?

xataku_nakusute
07-31-2003, 04:36 AM
are you retrieving the string values internally from the script or just retaining the data through user-input?

AdamGundry
07-31-2003, 04:46 AM
You can use parseInt() (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/toplev.html#1064173) to do it explicitly, but it will often be performed implicitly - JS is loosely typed, so performing maths on a string automatically converts it.

Adam