An array, as you might know, is a data structure to hold and manage data. Like other programming languages, even JavaScript has built-in support for arrays. Let’s see how to do an Array pop in JavaScript,
Define an array in JS
var arr = [1,2,3,4,5];
In JavaScript arrays are dynamic, in fact, JS is a dynamic language. You can add or remove items to an array at any time in your program.
Adding item to an array,
//different ways to add items
arr.push(6);
arr.concat(6,7);
arr = [...arr, 7,8];
You can also check out this post which talks about the various ways of adding items, multiple items to an array.
To remove items from an array we use the pop() method. It is also called an array pop.
var arr = ["a", "b", "c", "d"];
arr.pop(); //returns "d"
Pop removes an item from the end of the array.
Visualize it like a Stack. Popping out always happens from the top of the stack i.e the end of the array.