Javascript examples for Array:pop
Array pop method and length property
<html> <head> <script type="text/javascript"> var writeMessage = function (i) { return document.write("Element at " + (i + 1) + " popped-out with value " + array.pop() + ". Now, the array length is: " + array.length + "<br />"); }; var array = [50, 40, 30, 20, 10]; for (var i = 0; array.length > 0; i++) { writeMessage(i); } </script> </head> <body> </body>//from ww w . j a v a 2 s . co m </html>