Array#lastIndexOf – fromIndex evaluation

Asen Bozhilov asen.bozhilov at gmail.com
Sat Nov 3 12:28:38 PDT 2012


According to the spec if fromIndex is NaN or undefined the search will
start from 0. Step 5 of Array.prototype.lastIndexOf performs
ToInteger(fromIndex).
This is in contradiction with String.prototype.lastIndexOf, where even if I
pass a NaN or undefined for position value, the search will start again
from the end of the string.
I am wondering what is the intention of that decision, because it seems
like bug in specification.
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121103/e333058d/attachment.html>


More information about the es-discuss mailing list