When the above code is executed we get the following output:
Before deleting ------------- Jag Chat Win Dhan
After deleting ------------- Jag Chat Win
The above code is very similar to the code available in the first section with only the following change:
Earlier, in my previous example (in the first section), I used the “push” method. The “push” method accepts a parameter as an element to add. Coming to the “pop” method, it doesn’t accept any parameter to delete. That means when you issue “pop,” the last element (or the latest element added at the end of the array) gets deleted from the array automatically. Apart from this difference, the rest of the code is quite similar.