fix(javascript): call findLast in the TypedArray.findLast example - #45291
Open
rajanpanth wants to merge 1 commit into
Open
fix(javascript): call findLast in the TypedArray.findLast example#45291rajanpanth wants to merge 1 commit into
rajanpanth wants to merge 1 commit into
Conversation
The interactive example on the findLast page called find(), which returns the first negative value (-10), while the documented output is -30, the last one.
Contributor
|
Preview URLs (1 page) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The interactive example on
TypedArray.prototype.findLastcallsfind()rather thanfindLast():find()returns the first negative element,-10. The documented output-30is the last one, which is whatfindLast()returns. So the example both contradicts its own stated output and demonstrates the wrong method on the page that documentsfindLast.Verified in Node:
Changing the call to
findLast()makes the example produce the documented-30.I checked the sibling pages and they are all correct:
typedarray/findLastIndex,typedarray/findIndex,typedarray/find,array/findLastandarray/findLastIndexeach call their own method. This is the only page with the mismatch.Found by executing every
js interactive-exampleblock underfiles/en-us/web/javascriptthat carries an// Expected output:comment and comparing the actual scalar output against the documented one: 467 blocks ran, and this was the single value mismatch.