Skip to main content Accessibility Feedback

Arrays

Array.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);