25 lines
592 B
Markdown
25 lines
592 B
Markdown
|
---
|
||
|
title: Manipulate Arrays With pop()
|
||
|
localeTitle: Manipular Arrays Com pop ()
|
||
|
---
|
||
|
## Manipular Arrays Com pop ()
|
||
|
|
||
|
## Explicação do Problema
|
||
|
|
||
|
Livre-se do último elemento da matriz. Em seguida, atribua esse elemento montado a `removedFromMyArray` .
|
||
|
|
||
|
## Sugestão 1:
|
||
|
|
||
|
Chame `.pop()` na matriz e atribua-a a `removedFromMyArray` .
|
||
|
|
||
|
## Spoiler! Solução de Código:
|
||
|
|
||
|
```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 (); // Isso se livrou de 5
|
||
|
|
||
|
\`\` \`
|