25 lines
576 B
Markdown
25 lines
576 B
Markdown
|
---
|
|||
|
title: Manipulate Arrays With pop()
|
|||
|
localeTitle: 使用pop()操作数组
|
|||
|
---
|
|||
|
## 使用pop()操作数组
|
|||
|
|
|||
|
## 问题解释
|
|||
|
|
|||
|
摆脱数组中的最后一个元素。然后,将该骑行元素分配给`removedFromMyArray` 。
|
|||
|
|
|||
|
## 提示1:
|
|||
|
|
|||
|
在数组上调用`.pop()` ,并将其分配给`removedFromMyArray` 。
|
|||
|
|
|||
|
## 扰流板!代码解决方案
|
|||
|
|
|||
|
```javascript
|
|||
|
var removedFromMyArray = myArray.pop();
|
|||
|
=======
|
|||
|
Remove the last element of an array with the pop() method, like so:
|
|||
|
```
|
|||
|
|
|||
|
JavaScript的 var arr = \[1,2,3,4,5\]; arr.pop(); //这摆脱了5
|
|||
|
|
|||
|
\`\`\`
|