Originally Posted by Taro
like the parseInt('39',8), rather than just putting a single value.
You need to specify two parameters when calling parseInt as otherwhise it tries to guess the number base from the content - as Philip mentioned in his earlier post. By specifying the base in the second parameter you avoid the number being misinterpreted.
A common error is people using parseInt to convert a day or month string into a number instead of simply using Number(). Where the day or month is '08' or '09' then some browsers will assume the leading zero makes the number octal rather than decimal and since in base 8 you count 01, 02, 03, 04, 05, 06, 07, 010, 011 and there are no such numbers as 8 and 9 the person who wrote the code is left wondering why they are getting 0 when they expected 8 or 9. Specifying the second parameter as 10 resolves it - althougfh simply substituting Number() is an even more efficient resolution.