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

Tell us what’s happening:

I am not certain why this is not passing the challenge. It all checks out to me!

Your code so far


function popShift(arr) {

popShift.pop(); // change this line
popShift.shift(); // 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

You have two major issues with the above code.

  1. popShift is a function. The pop and shift array methods only work on arrays. An array is not a function.

  2. You return [shifted, popped], but you never define what shifted and popped are, so you are first going to get an error of shifted is not defined.