Remove Items from an Array with pop() and shift()1

Remove Items from an Array with pop() and shift()1
0

#1

Tell us what’s happening:
What I should do?

Your code so far


function popShift(arr) {
  let popped; // change this line
  let shifted; // change this line
  return [shifted, popped];
}

// do not change code below this line
console.log(popShift(['challenge', 'is', 'not', 'complete']));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/remove-items-from-an-array-with-pop-and-shift


#2

Method pop() removes last element in an array and returns it
Method shift() removes first element from an array and returns it.
so you should use
arr.pop(); assign it to popped variable,
arr.shift(); assign it to shifted variable.