Array methods

Array.prototype.pop()

Try the free JavaScript compiler

Removes the last indexed position and reduces length. Returns its value or undefined for an empty array. Mutates the receiver.

Formal Syntax & Structure

javascript syntaxjavascript
array.pop()

Return Value

any

Removed value or undefined.

Working Example

Example Snippetjavascript
const a=[2,4];console.log(a.pop(),a.length);
JavaScript Reference