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

592 B

title localeTitle
Manipulate Arrays With pop() 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:

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

`` `