Skip to content

replace forEach with for loop - #49794

Closed
Ram1607 wants to merge 4 commits into
nodejs:mainfrom
Ram1607:main
Closed

replace forEach with for loop#49794
Ram1607 wants to merge 4 commits into
nodejs:mainfrom
Ram1607:main

Conversation

@Ram1607

Copy link
Copy Markdown
Contributor

Changes will replace forEach loop to for loop

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Sep 22, 2023
@tniessentniessen added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Sep 22, 2023

@tniessentniessen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use for ... of instead of a traditional index-based for loop.

Comment threadtest/parallel/test-dgram-socket-buffer-size.js Outdated
Comment threadtest/parallel/test-dgram-socket-buffer-size.js Outdated
@Trott

Copy link
Copy Markdown
Member

What is the reason for this change? I see the code-and-learn label so I guess it is from...Grace Hopper Day or something?

@tniessen

Copy link
Copy Markdown
Member

@Trott Yes, most occurrences of forEach predate support for for ... of. The latter allows const variables and works with non-arrays.

@Ram1607Ram1607 changed the title Replace forEach with for loopreplace forEach with for loopSep 22, 2023
@lpincalpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 2, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 2, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

lpinca pushed a commit that referenced this pull request Nov 2, 2023
Replace `forEach()` with `for...of` in in test-dgram-socket-buffer-size.
PR-URL: #49794
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@lpinca

Copy link
Copy Markdown
Member

Landed in 196224c.

@lpincalpinca closed this Nov 2, 2023
targos pushed a commit that referenced this pull request Nov 11, 2023
Replace `forEach()` with `for...of` in in test-dgram-socket-buffer-size.
PR-URL: #49794
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@targostargos mentioned this pull request Nov 12, 2023
targos pushed a commit that referenced this pull request Nov 14, 2023
Replace `forEach()` with `for...of` in in test-dgram-socket-buffer-size.
PR-URL: #49794
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
UlisesGascon pushed a commit that referenced this pull request Dec 11, 2023
Replace `forEach()` with `for...of` in in test-dgram-socket-buffer-size.
PR-URL: #49794
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@UlisesGasconUlisesGascon mentioned this pull request Dec 12, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-and-learnIssues related to the Code-and-Learn events and PRs submitted during the events.needs-ciPRs that need a full CI run.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Ram1607@Trott@tniessen@nodejs-github-bot@lpinca