How to use pop()?

const words = ['Hello', 'Mischa', 42]

// output: ['Hello', 'Mischa', 42]
console.log(words)

// returns 42
words.pop()

// output: ['Hello', 'Mischa']
console.log(words)
Copy

December 4th, 2019

# pop() - Remove an item from the end of an array

Add to bookmarks

pop() removes the last item from the original array and returns it.

Tracking with Matomo to improve the UX. See Privacy Policy for more details.