Array.pop() : Pop : Array JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Array » Pop »

 

Array.pop()










The pop() method "pops" elements off the end of the array.

The pop() method deletes the last element of the array and sets the array's length property to one less than its current value.

This last element is returned from the method.

The following example uses the pop() Method to Remove Elements from the End of an Array.












<html>
    <script language="JavaScript">
    <!--
    pileOfPapers = new Array("a","b","c");

    currentPaper = pileOfPapers.pop()

    document.write(currentPaper," was removed from the pile.");
    -->
    </script>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Array
» Pop