Open declval opened 2 months ago
Confirmed. This is probably an error from trying to copy the prose from the analogous note in indexOf
. While we're here, we should probably take this prose out of the notes. This is exactly the kind of thing we typically put in the summary of a built-in or AO.
The last sentence of Note 1 in Array.prototype.lastIndexOf reads:
If the computed index is less than or equal to +0𝔽, -1𝔽 is returned.
If I understand it correctly it should be instead:
If the computed index is less than +0𝔽, -1𝔽 is returned.
If e.g. the length of the array is 2 and the optional fromIndex is -2 the computed index would be 0 and the loop at step 8 executes once comparing searchElement with the first element of the array, potentially returning 0 if they are the same according to the IsStrictlyEqual algorithm.