Array Methods : push() & pop() - 02

The .push() method :

push() method allows us to add items to the end of an array.












We access the push method by using dot, connecting push to itemTracker. Then we can call push() like a function because it can take single or multiple arguments separated by commas. 


This can also be called a destructive array method since it changes the initial array.



The .pop() method :

The array method .pop() removes the last item of an array. It does not take any argument.













Post a Comment

Previous Post Next Post