pop

.pop()

Removes the last element in this array, and returns it. If the array is empty, then null is returned.

names = [ 'Harry', 'Brian', 'Jenkins' ]

name = names.pop() // set to 'Jenkins'
name = names.pop() // set to 'Brian'
name = names.pop() // set to 'Harry'

See also

push - shift