Array.prototype.indexOf use of SameValue()
John-David Dalton
john.david.dalton at gmail.com
Tue Apr 28 11:34:49 PDT 2009
In the ECMA 5 RC spec I noticed that 15.4.4.14 Array.prototype.indexOf
(and lastIndexOf) make use of the SameValue operation.
The spec states that (9.12) SameValue will return true If Type(x) is
Undefined or Null.
Would this not cause an issue with 9c of the Array.prototype.indexOf spec.
"c. If SameValue(searchElement,elementK) is true, return k.".
[1,2,null].indexOf(null) -> SameValue(null, 1) -> true, return 0.
var undef;
[1,2,undef].indexOf(undef) -> SameValue(undefined, 1) -> true, return 0.
- JDD
More information about the es-discuss
mailing list