Basically the push() method inserts data at the end of the array and the pop() method removes the last element of the array.
<script> var dataaRRAY = new Array("John","Joe","Joseph"); dataArray.push("Jonard"); alert(dataArray); </script>
The result of the code will go like this, the word Jonard will be placed on the last part of the array or at index . The push() method is a great way to insert data if you don't care on the position. This is also been used in most data structure problems. Additionally this method also changes the length of the array as there has been additional contents being inserted.
On the other hand, the pop() method removes the last element of the array.
<script> var dataaRRAY = new Array("John","Joe","Joseph"); dataArray.push(); alert(dataArray); </script>
The pop method will remove the last item on the array and in our case "Joseph" will be removed.
The pop() and push() methods are commonly used for FIFO (First in First Out) or LIFO (Last in First Out) problems. And can also be used if you are handling numerous items.