fix(curriculum): clear up confusion of array index (#45576)
parent
7fef4346a4
commit
405675261d
|
@ -19,11 +19,11 @@ Array indexes are written in the same bracket notation that strings use, except
|
|||
|
||||
```js
|
||||
const array = [50, 60, 70];
|
||||
array[0];
|
||||
console.log(array[0]);
|
||||
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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue