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

PHOTO EMBED

Thu Jan 05 2023 20:55:31 GMT+0000 (Coordinated Universal Time)

Saved by @abdishakur #javascript

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"]));
content_copyCOPY

https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-remove-items-from-an-array-with-pop-and-shift/301165