Removes the last element from an array and returns it.
Syntaxpop( )
Examples
The following example illustrates the use of the pop method.
var number;
var my_array = new Array();
my_array.push (5, 6, 7);
my_array.push (8, 9);
number = my_array.pop();
while (number != undefined)
{
document.write (number + " ");
number = my_array.pop();
}
Remarks
The push and pop methods enable you to simulate a stack, which uses the principle of last in, first out (LIFO) to store data.
The required arrayObj reference is an Array object.
If the array is empty, undefined is returned.
See also Specification15.4.4.6 Array.prototype.pop ( ) ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011
AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4