Avoid classical for when looping through all items of an Array-like object (part #2)#19405
Avoid classical for when looping through all items of an Array-like object (part #2)#19405
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Josh-Cena
left a comment
There was a problem hiding this comment.
Not a thorough review; would go over this again after the initial reviews are addressed
files/en-us/web/api/performancenavigationtiming/dominteractive/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/api/performanceresourcetiming/decodedbodysize/index.md
Outdated
Show resolved
Hide resolved
|
@Josh-Cena When you have time, can you double-check this PR? I think I have fixed all the review comments. |
|
Sorry for being a little slow. My academic life is picking up and I don't always have access to a computer this week. This PR has a lot of moving parts and reviewing takes some mental energy. I'll try setting aside some time tomorrow. |
No worry, I guessed your academic life started again. Take your time. |
files/en-us/web/api/touch_events/multi-touch_interaction/index.md
Outdated
Show resolved
Hide resolved
|
I have no further comments. I don't know enough of some of the code examples to be able to review if they are correct or not, though they seem good for me. |
Josh-Cena
left a comment
There was a problem hiding this comment.
Sorry for being so slow to get to this. This looks great to me (had to go through a lot of code that looks almost the same...)
…bject (part mdn#2) (mdn#19405) * Avoid classical for if for...of when looping all object of an Array-like object * Remove addictions from MDN * Add checkPerformanceEntry * Use same example * Use same example * Fix naming * Fix names * Fix name * Fix name * Fix name * Fix name * Rename function * Rename function * Fix name * Fix name * Remove useless const * Remove useless variable * fix name * Fix name * Fix name * Fix name * Fix name * Fix name * Fix name * Remove useless variable * Remove useless variable * Remove useless variable * Remove useless varaible * Rename function * fix function name * Fix function name * Fix function name * Fix function name * Add empty line * Fix function names * Update files/en-us/web/api/performanceresourcetiming/decodedbodysize/index.md Co-authored-by: Joshua Chen <[email protected]> * Fix function names * Fix function name * Fix function names * Fix function names * Fix function names * Fix function names * fix function names * Fix function names * Fix function names * Fix function names * Fix function names * Fix function names * Use ternary operator * Fix function names * Use method * Update files/en-us/web/api/texttrack/mode/index.md Co-authored-by: Joshua Chen <[email protected]> * Update files/en-us/web/api/performance/getentriesbytype/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/performance/getentriesbytype/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/performance_timeline/using_performance_timeline/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/performance/getentriesbytype/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/performance_timeline/using_performance_timeline/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/performance_timeline/using_performance_timeline/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/performance_timeline/using_performance_timeline/index.md Co-authored-by: rubiesonthesky <[email protected]> * Update files/en-us/web/api/speechsynthesisvoice/name/index.md Co-authored-by: rubiesonthesky <[email protected]> * Readd example * readd example * Add workerStart to the list * Replace for…in * Use findIndex() * Use findIndex() * Fix function names (no _) * Fix alignement + for…in * Alignment * Update files/en-us/web/api/performanceresourcetiming/transfersize/index.md Co-authored-by: Joshua Chen <[email protected]> * Use ?? * Use ?? * Use ?? * Use ?? * Use ?? * Use ?? * Update files/en-us/web/api/performanceresourcetiming/connectstart/index.md * Use ?? * Use ?? * Remove empty space * Remove space * Use ?? * Use ?? * Use ?? * Use ?? * Use ?? * Use ?? * Use ?? * Use ?? * Use ?? * Apply suggestions from code review * Use console.log * Use console.log * Use console.log * Use console.log * Use console.log * console.log * console.log * Apply suggestions from code review * Update index.md * Update index.md * Update index.md * Remove useless variable * Fix typo * Use findLastIndex() * Update index.md * Update index.md Co-authored-by: Joshua Chen <[email protected]> Co-authored-by: rubiesonthesky <[email protected]>
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.Array.from()instead.