=== again (sorry)

Erik Arvidsson erik.arvidsson at gmail.com
Sun Nov 2 09:17:03 PST 2008


I see a small risk with changing this. Array.prototype.indexOf is  
widely emulated in IE and is also used a lot in browser that support it.

This change would cause issues with NaN and -0.  However I don't think  
that changing these 2 edge cases would lead to too many serious issues.

2008/10/31 David-Sarah Hopwood <david.hopwood at industrial- 
designers.co.uk>:
> Mark S. Miller wrote:
>> According to the ES3.1 spec and the behavior of at least FF3.0.3
>>
>>    [4, -0, 0, NaN, 8].indexOf(0); // yields 1
>>    [4, -0, 0, NaN, 8].indexOf(NaN); // yields -1
>>
>> This is because indexOf and lastIndexOf are specified in terms of ===
>> rather than SameValue. Is there any reason not to consider this a bug
>> that should be fixed? In ES-Harmony, we've agreed that Map lookup  
>> will
>> be according to SameValue (i.e. Object.eq or Object.identical).
>>
>> The indexOf and lastIndexOf methods are new in ES3.1, and are the  
>> only
>> methods in the entire spec that depend on ===.
>
> In that case it should certainly be fixed.
>
> --
> David-Sarah Hopwood
>
> _______________________________________________
> Es3.x-discuss mailing list
> Es3.x-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es3.x-discuss
>



-- 
erik



More information about the Es-discuss mailing list