Define an array in JS
var arr = [1,2,3,4,5];
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.