Few ways to add and remove items in an array
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
pushinserts the elements at the end whereaspoppops out the top one that is the last item in the array.
shift and unshift methods
shiftremoves the first element of an array whereasunshiftdoes exact the opposite.
It is called
shiftbecause once the method is called the items of an array shifts one position left if one pictures the array horizontally. \O/
