Avoid classical for if for...of when looping all object of an Array-like object (part #4)#19544
Merged
Avoid classical for if for...of when looping all object of an Array-like object (part #4)#19544
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Josh-Cena
reviewed
Aug 14, 2022
Co-authored-by: rubiesonthesky <[email protected]>
Co-authored-by: rubiesonthesky <[email protected]>
files/en-us/web/api/canvas_api/manipulating_video_using_canvas/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: rubiesonthesky <[email protected]>
…/index.md Co-authored-by: rubiesonthesky <[email protected]>
Co-authored-by: rubiesonthesky <[email protected]>
Co-authored-by: rubiesonthesky <[email protected]>
Co-authored-by: rubiesonthesky <[email protected]>
Contributor
|
You probably know this , but using |
Josh-Cena
reviewed
Aug 16, 2022
Josh-Cena
reviewed
Aug 16, 2022
Josh-Cena
reviewed
Aug 16, 2022
Contributor
rubiesonthesky
left a comment
There was a problem hiding this comment.
These look good to me.
goshdarnheck
pushed a commit
to goshdarnheck/content
that referenced
this pull request
Sep 7, 2022
…ike object (part mdn#4) (mdn#19544) * Avoid classical for if for...of when looping all object of an Array-like object * Update files/en-us/web/api/btoa/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/btoa/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/canvas_api/tutorial/using_images/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/canvas_api/manipulating_video_using_canvas/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/element/getclientrects/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/document/images/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/canvasrenderingcontext2d/arcto/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update index.md * Update index.md * Update index.md * Update index.md * Update index.md * Update index.md * Update index.md * Update index.md * Update index.md * Revert change (The world is not ready) * Use for...of for CSSRuleList * Update index.md * Update index.md * Update index.md * Update index.md Co-authored-by: rubiesonthesky <[email protected]> Co-authored-by: Joshua Chen <[email protected]>
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.
Classical
forloops are error-prone (setting the right condition, not mixing indices…) and difficult to read when used to loop on all elements of an Array-like structure.This PR changes some occurrences to use the modern
for…of, or.forEach()in some occurrences.Note that:
for…ofif I don't need the index.forEach()when I do, or on an object wherefor…ofmay not work.UintXYArray.from()instead.