=== again (sorry)

Mark S. Miller erights at google.com
Fri Oct 31 16:48:32 PDT 2008


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 ===. So it's not too late to
fix this.

-- 
    Cheers,
    --MarkM


More information about the Es-discuss mailing list