if have a value like "08" and when i apply parseInt() on it,it shows 0 rather 8?why?
Thanks
-adnan
Bernard Marx
7:30 am on Sep 17, 2005 (gmt 0)
Specify the radix in the 2nd arg:
alert( parseInt( "08", 10 ) )
[Still can't work out why it's zero though just now]
kadnan
8:50 am on Sep 17, 2005 (gmt 0)
i rather used eval("08"),working fine now
-adnan
jalarie
11:59 am on Sep 19, 2005 (gmt 0)
The leading zero switches the default radix to 8 instead of 10. The valid base-8 digits are 0-7, so the "08" has no valid digits other than the zero. Result is zero.