30 lines
917 B
Markdown
30 lines
917 B
Markdown
|
---
|
|||
|
title: JSON Arrays
|
|||
|
localeTitle: JSON数组
|
|||
|
---
|
|||
|
## JSON数组
|
|||
|
|
|||
|
JSON数组与您在Javascript中使用的普通数组对象没有什么不同。它是一个包含多个`JSON Objects`的数组`JSON Objects` 。
|
|||
|
|
|||
|
以下是JSON数组的示例:
|
|||
|
|
|||
|
```Javascript
|
|||
|
var aMyPlaylist = [{
|
|||
|
artist: "Ed Sheeran",
|
|||
|
track: "Supermarket flowers",
|
|||
|
myRating: 10
|
|||
|
}, {
|
|||
|
artist: "Tracy Chapman",
|
|||
|
track: "Fastcar",
|
|||
|
myRating: 9
|
|||
|
}];
|
|||
|
```
|
|||
|
|
|||
|
这是一个名为`aMyPlaylist`的JSON数组。所有数组方法(如`map` , `filter` , `sort`等)也可以应用于任何JSON数组
|
|||
|
|
|||
|
#### 更多信息:
|
|||
|
|
|||
|
可以在以下链接中找到更多数组方法
|
|||
|
|
|||
|
* [数组 - Freecodecamp](https://guide.freecodecamp.org/javascript/standard-objects/array)
|
|||
|
* [阵列 - Mozilla开发者网络](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
|