JavaScript: Array.prototype.pop

By Xah Lee. Date: . Last updated: .
arrayX.pop()
  • Remove and return the last item.
  • If arrayX is empty, return undefined.
// example of pop

const xx = [3, 4];

const xy = xx.pop();

console.log(xy === 4);

console.log(JSON.stringify(xx) === "[3]");

JavaScript: Array, add/remove items

BUY
ΣJS
JavaScript in Depth

JS Obj Reference

Array

prototype