title: For loop through Array only shows last value
body: <p>I'm trying to loop through an Array which then uses innerHTML to create a new <li> element for every entry in the array. Somehow my code is only showing the last value from the array. I've been stuck on this for a few hours and can't seem to figure out what I'm doing wrong. </p>
  
  <pre><code>window.onload = function() {
  
  // Read value from storage, or empty array
  var names = JSON.parse(localStorage.getItem('locname') || "[]");
  var i = 0;
  
      n = (names.length);
      for (i = 0; i &lt;= (n-1); i++) {
          var list = names[i];
          var myList = document.getElementById("list");
          myList.innerHTML = "&lt;li class='list-group-item' id='listItem'&gt;"+ list + "&lt;/li&gt;" + "&lt;br /&gt;";
      }
  }
  </code></pre>
  
  <p>I have a UL with the id 'list' in my HTML. </p>