Update README.zh-cn.md

pull/405/head
Flex Zhong 4 years ago committed by GitHub
parent 14c4c127eb
commit b45d1ef073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,11 +21,15 @@
数组的语法需要一对方括号。
`let myArray = [];`
```javascript
let myArray = [];
```
这是一个空数组,但数组其实可以在声明时就存入一些数据。数组中的多项数据用逗号分隔。
`let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];`
```javascript
let iceCreamFlavors = ["Chocolate", "Strawberry", "Vanilla", "Pistachio", "Rocky Road"];
```
数组中的值会被指定一个唯一的值,称为 **索引index**,它是一个整数,表示对应值在数组中的位置与数组开头的距离。在上方的例子中,字符串值 `"Chocolate"` 的索引就是 0`"Rocky Road"` 的索引是 4。可以用索引加上方括号来获取、改变或者插入数组值。

Loading…
Cancel
Save