title: cannot iterate through array and change value in JS
body: <p>I have to iterate through an array, change one of its values, and create another array refelecting the changes.</p>
  
  <p>this is what I have so far:</p>
  
  <p>JS:</p>
  
  <pre><code>var arr = new Array();
  
          arr['t1'] = "sdfsdf";
          arr['t2'] = "sdfsdf";
          arr['t3'] = "sdfsdf";
          arr['t4'] = "sdfsdf";
          arr['t5'] = "sdfsdf";
  
          var last = new Array();
  
          for (var i = 0; i &lt;= 5; i++) {
              arr['t2'] = i;
              last.push(arr);
          }
  
          console.log(last);
  </code></pre>
  
  <p>Unfortunately, these are my results</p>
  
  <p><img src="https://i.stack.imgur.com/dHoM1.jpg" alt="enter image description here"></p>
  
  <p>As you can see, I am not getting the results needed as 0,1,2.. instead I am getting 2, 2, 2..
  This is what i would like my results to be: </p>
  
  <p><img src="https://i.stack.imgur.com/MzHNq.jpg" alt="enter image description here"></p>
  
  <p>How can I fix this? </p>