Status: Accepted
Owner: [email protected]
Labels: Type-Bug Priority-Medium ES5
New issue 754 by [email protected]: Array.lastIndexOf does not correctly
handle null and undefined values as the fromIndex argument
http://code.google.com/p/v8/issues/detail?id=754
If the fromIndex argument to Array.lastIndexOf is null or undefined (but
provided) we search the complete array, but we should not only search index
0 (since ToNumber on null or undefined gives 0).
What will reproduce the problem:
var a = new Array(1,2,1);
print(a.lastIndexOf(1, undefined));
print(a.lastIndexOf(1, null));
print(a.lastIndexOf(2, undefined));
print(a.lastIndexOf(2, null));
Expected result:
0
0
-1
-1
Actual result:
2
2
1
1
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev