JS: Array.prototype.pop

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

console.log(xx);
// [ 3, 4 ]

console.log(yy);
// 5