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

# Remove an item from the end of an array

Add to bookmarks

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

HomeBookmarks