Array.pop

pop — Removes the last element off an array and returns it.

Description

Array.pop()

Return values

mixed. The value that was removed.

Examples

Example #1 – pop example
var array = [2, 4, 8, 16]; console.log(array); // [2, 4, 8, 16] console.log(array.length); // 4 console.log(array.pop()); // 16 console.log(array); // [2, 4, 8] console.log(array.length); // 3

See also

External references