title: javascript;storing values in array
body: <p>I am trying to store values in array using javascript..but i get strange error in javascript.below is my code</p>
  
  <pre><code>var a = 1;
  for(i=0;i&lt;4;i++)
  {
  
  var all = new Array();
  all[i]=a;
  a++;
  }
  
  alert(all[1]);
  alert(all[2]);
  alert(all[3]);
  </code></pre>
  
  <p>please check the code here : <a href="http://jsfiddle.net/D8Suq/" rel="nofollow">http://jsfiddle.net/D8Suq/</a></p>
  
  <p>for all[1] and all[2] i am getting undefined error..but all[3] is working fine,,,am confused.some one please help me</p>