mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-30 21:03:58 -05:00
chore(i18n,learn): processed translations (#51481)
This commit is contained in:
@@ -9,21 +9,21 @@ dashedName: manipulate-arrays-with-push
|
||||
|
||||
# --description--
|
||||
|
||||
一个将数据添加到数组末尾的简单方法是 `push()` 函数。
|
||||
An easy way to append data to the end of an array is via the `push()` method.
|
||||
|
||||
`.push()` 接受一个或多个参数(<dfn>parameters</dfn>),并把它压入到数组的末尾。
|
||||
The `push()` method takes one or more <dfn>arguments</dfn> and appends them to the end of the array, in the order in which they appear. It returns the new length of the array.
|
||||
|
||||
示例:
|
||||
|
||||
```js
|
||||
const arr1 = [1, 2, 3];
|
||||
arr1.push(4);
|
||||
arr1.push(4, 5);
|
||||
|
||||
const arr2 = ["Stimpson", "J", "cat"];
|
||||
arr2.push(["happy", "joy"]);
|
||||
```
|
||||
|
||||
`arr1` 现在值为 `[1, 2, 3, 4]`,`arr2` 值为 `["Stimpson", "J", "cat", ["happy", "joy"]]`。
|
||||
`arr1` now has the value `[1, 2, 3, 4, 5]` and `arr2` has the value `["Stimpson", "J", "cat", ["happy", "joy"]]`.
|
||||
|
||||
# --instructions--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user