mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-26 03:02:39 -05:00
608 B
608 B
title, localeTitle
| 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áveispoppedeshiftedpara 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']));