title: javascript increment name of variable
body: <p>I get an object with partial results of match from database. </p>
  
  <pre><code>[Object { home1=4, away1=3, home2=4, away2=5, home3=6, away3=7, home4=6, away4=5, home5=3, away5=6}]
  </code></pre>
  
  <p>home1 it's a result of first part of home team,
  away1 -> away team, home2 it's a result of second part of home team... etc etc</p>
  
  <p>data in my case is each row, which i get from database. 
  In rows i have td with class: home1, home2, home3, away1, away2 and there are values of corresponding part of match.
  I want to check if value is equal to what I got from database. 
  Something like this</p>
  
  <pre><code>if ($('.home1') === data[index].home1;
  if($('.away2') === data[index].away2;
  </code></pre>
  
  <p>there should be some loop. I have no idea how to do this, I thought about an array</p>
  
  <pre><code>var array = [
  
                          {
                               home1: data[index].home1,
                               away1: data[index].away1
                          },
                            {
                               home2: data[index].home2,
                               away2: data[index].away2
                          },
                            {
                               home3: data[index].home3,
                               away3: data[index].away3
                          },
                           {
                               home4: data[index].home4,
                               away4: data[index].away4
                          },
                           {
                               home5: data[index].home5,
                               away5: data[index].away5
                          }
  
  
                      ]
  </code></pre>
  
  <p>and then for loop:</p>
  
  <pre><code>for(var X=0; X&lt;5;X++){
  homeX == data[index].homeX 
  }
  </code></pre>
  
  <p>How can I increment name of variable by eval function? or is there any other solution? I'm very confused.</p>