Skip to main content Accessibility Feedback

Arrays

Array.prototype.pop()

Remove the last item from an array and returns it. The array is modified.

let wizards = ['Gandalf', 'Radagast', 'Merlin'];
let last = wizards.pop();

// logs "Merlin"
console.log(last);

// logs ["Gandalf", "Radagast"]
console.log(wizards);

Preorder my new course on Web Components! Want to learn how to build Web Components from scratch, master best practices, and more? Preorder today and get $100 off of the launch price.


Find this useful? You can support my work by purchasing an annual membership.