Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in Note 1 of Array.prototype.lastIndexOf #3314

Open
declval opened this issue Apr 18, 2024 · 1 comment
Open

Typo in Note 1 of Array.prototype.lastIndexOf #3314

declval opened this issue Apr 18, 2024 · 1 comment

Comments

@declval
Copy link

declval commented Apr 18, 2024

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.

@michaelficarra
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants