pop()
JavaScript Array pop() method
Last Updated : 17 Mar 2025
The JavaScript array pop() method removes the last element from the given array and return that element. This method changes the length of the original array.
Syntax
The pop() method is represented by the following syntax:
Return
The last element of given array.
JavaScript Array pop() method example
Let's see some examples of pop() method.
Example 1
Here, we will pop an element from the given array.
Test it NowOutput:
Orginal array: AngularJS,Node.js,JQuery Extracted element: JQuery Remaining elements: AngulaJS,Node.js
Example 2
In this example, we will pop all the elements from the given array.
Test it NowOutput:
Extracted element: JQuery Extracted element: Node.js Extracted element: AngulaJS