title: How do I append a variable to another variable in JavaScript?
body: <p>I am running a loop, and I am trying to create a variable each time the loop runs with the number of the counter appended to the end of the variable name.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>var counter = 1;
  while(counter &lt; 4) {
    var name+counter = 5;
    counter++;
  }
  </code></pre>
  
  <p>So after the loop runs there should be 3 variables named name1, name2, and name3. How can I append the counter number to the end of the variable I am creating in the loop?</p>