title: Mystery code: +i+ and +x+
body: <p>In the following code:</p>
  
  <pre><code>for (i=0; i&lt;itemsinlist.length; i++) {
          var rating = document.createElement('div');
          itemsinlist[i].appendChild(rating);
          rating.className = "rating";
          rating.id = "thumbnails" +i;
  
          for (x=0; x&lt;4; x++) {
          star = document.createElement('span');
          star.innerHTML = "&amp;#9733;";
          star.className = "star";
          star.setAttribute("onclick", "ratingsSet("+i+","+x+");");
          rating.appendChild(star);
  } //createratingsstars
  </code></pre>
  
  <p>I'm struggling to make sense of the second parameter to <code>star.setAttribute()</code>, in the line:</p>
  
  <pre><code>star.setAttribute("onclick", "ratingsSet("+i+","+x+");");
  </code></pre>
  
  <p>Specifically, I'm being thrown off by the <code>+i+</code> and <code>+x+</code>.</p>
  
  <p>At first I thought these were some kind of variation on the increment operator, but later decided it must be concatenating something, but I can't figure out what/how. The HTML that gets generated by the loop is:</p>
  
  <pre><code>&lt;span class="star" onclick="ratingsSet(0,0);"&gt;*&lt;/span&gt;
  &lt;span class="star" onclick="ratingsSet(0,1);"&gt;*&lt;/span&gt;
  &lt;span class="star" onclick="ratingsSet(0,2);"&gt;*&lt;/span&gt;
  &lt;span class="star" onclick="ratingsSet(0,3);"&gt;*&lt;/span&gt;
  </code></pre>
  
  <p>But my reverse-engineering chops are failing me (if I had any to begin with).</p>
  
  <p>Help?</p>