Parameters: This method does not accept any parameter.
Return value This method returns the removed element array. If the array is empty, then this function returns undefined.
Below is an example of the Array pop() method.
Example 2: In this example, the pop() method removes the last element from the array, which is 4, and returns it.
Example 3: In this example, the function pop() tries to extract the last element of the array but since the array is empty therefore it returns undefined as the answer.
- Google Chrome 1.0 and above
- Microsoft Edge 12 and above
- Mozilla Firefox 1.0 and above
- Safari 1 and above
- Opera 4 and above