Skip to content

数组

一句话解释

数组 是 有序 列表 的 值, accessed 通过 numeric 索引 开始 at 0.

用大白话说

array 是一种list of values stored in a single variable。 Each value (element) has a numeric position (index) starting at 0. Arrays can hold any type of value — numbers, strings, objects, even other arrays.

JavaScript arrays are dynamic — they can grow and shrink. Common methods include 推送 (add to end), pop (remove from end), 映射 (transform each element), 筛选 (keep matching elements), and reduce (combine into one value).

Arrays are reference types — assigning an array to a new variable does not copy it; both point to the same array. To copy, use the spread operator [...arr] or arr.slice().

示例

javascript
const fruits = ["apple", "banana", "cherry"];
console.log(fruits[0]);       // "apple"
console.log(fruits.length);   // 3
fruits.push("date");
console.log(fruits.length);   // 4

数组 use 零-based indexing and 有 长度 属性.

相关术语

相关资源

相关课程

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表