Javascript array pop() is an inbuilt method that removes the last item from an array and returns that element. The pop() method changes the length of an array that is why it is not a pure function.
Javascript array pop() method changes the length of the array. If we want to remove the first element of an array, use the shift() method.
The pop() method is intentionally generic and can be called or applied to objects resembling arrays.
The objects which do not contain the length property reflecting the last in the series of consecutive may not behave in any meaningful manner.
If the array is empty, then the removed item is undefined.
Let us take a simple example. Create an app.js file.
#javascript #app.js #undefined