Using js array as stack
<p>I think it should alert 4 times, but why it just alerted just 2 times. Is there anyone can make an explanation for me?</p>

<pre><code>   var arr = new Array;

   arr.push("1");
   arr.push("2");
   arr.push("3");
   arr.push("4");

   for(var i=0;i&lt;arr.length;i++){
     alert(arr.pop());
   }
</code></pre>
