reduxjs / redux

A JS library for predictable global state management

Home Page:https://redux.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix simple issue in the documentation

M-AminAlizadeh opened this issue · comments

This is the link to the issue

What is the problem?

The problem is in the code part in the arr variable
this is what is written in the code part

const arr = ['a', 'b']
// In the same way, we can change the contents of this array
arr.push('c')
arr[1] = 'd'

What should be changed to fix the problem?

In the arr[1] = 'd' should change to arr[1] = 'b'

This isn't an issue. The documentation is making the point that you can change the second item of the array with the assignment.

Your suggested change is not changing the array item, it's exactly the same.

Thank you for responding @EskiMojo14
My bad
But it should have only one change like object one, not two different changes push() method and indexing
It's misleading the reader in my opinion

both are methods of mutating an array, it's entirely valid to do one after the other.

image