reactjs / reactjs/react.dev

Update Tutorial to use ES6 syntax to iterate over lines

Open
#2,673 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

The tutorial uses a for statement to iterate through an iterable Object in the calculateWinner helper function. This can be replaced with an es6 for ... of. The tangible benefit of using for ... of over for when you're working with an iterable object is that for ... of decreases the incidence of off-by-one errors.

I've prepared a fork for what this would look like here: https://github.com/reactjs/reactjs.org/compare/master...arg4:patch-2.

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the tutorial and locate the calculateWinner helper, then inspect the current for statement that iterates over the iterable object. Update that iteration to use ES6 for...of syntax and verify that the tutorial's behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.