how to add incremental values to elements i'm creating in a for loop
<p>I want to make sure the option elements I'm creating in this function have values 0,1,2,3,4….. so they match the index number. I'm just not sure how to do that in the for loop.</p>

<p>Any help would be awesome. Thanks</p>

<pre><code>function receiveAnswer(response) {
  var aSeats = document.getElementById("aSeats");
  while (aSeats.childNodes.length &gt; 0) { // clear it out
    aSeats.removeChild(aSeats.childNodes[0]);
  }
  for (var i = 0; i &lt; response.aSeats.length; i++) { // add the items back in
    var option = aSeats.appendChild(document.createElement("option"));
    option.appendChild(document.createTextNode(response.aSeats[i]));
  }
}
</code></pre>
