Actually, according to that mdn page I just linked, ES5 (which V8
implements) should not try to parse octal mode and in a way it's a bug.
 But changing the behavior will "break the web" for sites that expect the
ES3 behavior.  Isn't JavaScript versioning fun?

On Tue, Feb 21, 2012 at 3:46 PM, Tim Caswell <[email protected]> wrote:

> It's not so much a V8 bug, but an unfortunate feature of JavaScript
> itself.  Crockford would call this one of the "bad parts".  parseInt()
> tries to be clever and guess the radix if you don't give it one.  Numbers
> starting with "0" are assumed to be octal (unless it starts with "0x" of
> course).
>
> While it's annoying, it's a good idea to always specify the radix (the
> second argument to parseInt) when parsing numbers and you know the
> radix. This is why jslint yells at you if you leave this "optional"
> argument off.
>
>
> https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt
>
>
> On Tue, Feb 21, 2012 at 3:34 PM, danp <[email protected]> wrote:
>
>> This is a V8 bug, but it's better to know it.
>>
>> Parsing "08" or "09" with parseInt returns 0, not 8 or 9.
>>
>> I've got out of mind to debug a peace of code that uses minutes from
>> the current time string, and goes wrong only at minute 8 and 9 of
>> every hour.
>> That's true since version 0.6.8 for sure.
>>
>> Dan
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to