How to use Array pop in JavaScript

In this article we will discuss about How to use Array pop() Method in JavaScript.
  • 2156

The pop() method is most popular method of an Array object in JavaScript. This method is used to remove the last inserted element in the Array and also returns this removed element. Lets have a look on the syntax of this method.



It will remove the last inserted element from the Array.

JavaScript Code:



    <title>JavaScript Array pop Method</title>



    <script type="text/javascript">

        var values = [5, 8, 1];


        var removelement = values.pop();

        document.write("element is : " + removelement);


        var removelement = values.pop();

        document.write("<br />element is : " + removelement);






Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.