608 B
608 B
title | localeTitle |
---|---|
Remove Items from an Array with pop() and shift() | Remover itens de uma matriz com pop () e shift () |
Remover itens de uma matriz com pop () e shift ()
- O método
.pop()
e o método.shift()
devem ser chamados e inicializados usando as variáveispopped
eshifted
para retornar a resposta correta da função.
Solução:
function popShift(arr) {
let popped = arr.pop();
let shifted = arr.shift();
return [shifted, popped];
}
// do not change code below this line
console.log(popShift(['challenge', 'is', 'not', 'complete']));