fix(curriculum): clear up confusion of array index (#45576)
This commit is contained in:
@ -19,11 +19,11 @@ Array indexes are written in the same bracket notation that strings use, except
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const array = [50, 60, 70];
|
const array = [50, 60, 70];
|
||||||
array[0];
|
console.log(array[0]);
|
||||||
const data = array[1];
|
const data = array[1];
|
||||||
```
|
```
|
||||||
|
|
||||||
`array[0]` is now `50`, and `data` has the value `60`.
|
The `console.log(array[0])` prints `50`, and `data` has the value `60`.
|
||||||
|
|
||||||
**Note:** There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
|
**Note:** There shouldn't be any spaces between the array name and the square brackets, like `array [0]`. Although JavaScript is able to process this correctly, this may confuse other programmers reading your code.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user