[thelist] javascript question on formatting numbers.

Danny Goodman dannyg at dannyg.com
Mon Dec 24 12:34:58 CST 2001


> 
> Be careful using parseInt() here.  If the string starts with a 0 it
> will be parsed as an octal number.

Use the optional second parameter (radix value) to force conversion to
base-10:

var int = parseInt(string, 10);


Danny
http://www.dannyg.com





More information about the thelist mailing list