pop - Remove last element of an Array in JavaScript

Pop method removes last element of an Array and return the item.

General Syntax :

Example : Remove last element from an Array
<script type="text/javascript">
pileOfPapers = new Array("a","b","c");

currentPaper = pileOfPapers.pop(); 

document.write(currentPaper+"  was removed from the pile. \n");

document.write("\n Pile of papers "+pileOfPapers);

To remove the first element use shift() function