freeCodeCamp/guide/chinese/certifications/javascript-algorithms-and-d.../basic-javascript/manipulate-arrays-with-push/index.md

13 lines
297 B
Markdown
Raw Normal View History

---
title: Manipulate Arrays With push()
localeTitle: 用push操纵数组
---
## 用push操纵数组
`push()`方法允许您将元素追加(添加到末尾)到数组。像这样......
```javascript
var arr = [1, 2, 3, 4];
arr.push(5); // Now, the array is [1, 2, 3, 4, 5]
```