English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript Array pop() Method

 JavaScript Array Object

The pop() method removes the last element from the array and returns the element...

This method changes the length of the array.

If this method is called on an empty arraypop(), it will returnundefined.

Note: IfTo delete the first element of the array, useshift()Method.

Syntax:

array.pop()
var fruits = ["Banana", "Mango", "Apple", "Orange"];
fruits.pop();
Test and see‹/›

Browser Compatibility

The numbers in the table specify the first browser version that fully supports the pop() method:

Method
pop()11IsIs5.5

Technical Details

Return Value:Returns the element removed from the array
JavaScript Version:ECMAScript 1

More Examples

Inpop()The method returns the value of "popped":

var fruits = ["Banana", "Mango", "Apple", "Orange"];
var x = fruits.pop();
Test and see‹/›

 JavaScript Array Object