How do you declare variables x1, x2,...,x10 using a loop function in JavaScript?
<p>I am trying to run the following code in JavaScript to accomplish the following task: declare a series of variables that essentially have the same name but are only different in their suffix, which is an integer, e.g. x1,x2,x3... and so on.</p>

<p>I am new to JavaScript (in fact, I'm entirely new to the coding world). The following code is what I thought made logical sense but it doesn't want to execute the way I want it to.</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>for (i = 1; i&lt;11; i++) {
  var x+i = 'variable'+i;
  }</code></pre>
</div>
</div>
</p>

<p>There's something else I wish to do...</p>

<p>Say, for example, I made a construct such as the following and then proceeded to create customised objects (student1, student2, student3). My end goal is to print out, sequentially, the student's name and a comment on their grade. Instead of having to type out the function that would print this out for each student I would like to write a loop that would make this process more efficient. However, trying to do this has proven a bit difficult. Here is the code:</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var grade = function(grade) {
  switch (grade) {
      case "A": " could not do any better. Well done";
      break;
      case "C": " had average performance. There's room to improve.";
      break;
      case "F": ", an unfortunate result. Will have to try again next year.";
      break;
      default: ".";
      break;
      }
  };

function Student(name, sgrade) {
  this.name = name;
  this.grade = sgrade;
  this.print = function() {
    console.log(this.name+grade(this.grade));
  };
 }

var student1 = new Student("Candice R.", "A");
var student2 = new Student("Robert K.", "C");
var student3 = new Student("Steven M.", "F");

for (i = 1; i&lt;4; i++) {
  student+i.print();
  }

/* student[i].print() also doesn't work */</code></pre>
</div>
</div>
</p>

<p>Can someone tell me what logic of JavaScript I am not fully understanding that does not allow the above to execute, and is there another way? </p>