There more than one way to add an item to an array and remove an item from an array in JavaScript. Let’s see how can we do that in this post.

push and pop methods

push and pop methods usage

Note: push inserts the elements at the end whereas pop pops out the top one that is the last item in the array.

shift and unshift methods

shift and unshift methods usage

Note: shift removes the first element of an array whereas unshift does exact the opposite.

Tip: It is called shift because once the method is called the items of an array shifts one position left if one pictures the array horizontally. \O/