JS: Array.prototype.pop

By Xah Lee. Date: . Last updated: .
myArray.pop()
  • Remove and return the last item.
  • If myArray is empty, return undefined.
// example of pop
const xx = [3, 4];
const yy = xx.pop();
console.log(yy === 4);
console.log(JSON.stringify(xx) === "[3]");

JavaScript, Array Push Pop