title: Javascript, jquery - Call array position by using a variable name
body: <p>I have 2 arrays:</p>
  
  <pre><code>var array1 = [50,60];
  var array2 = [120,180];
  </code></pre>
  
  <p>I am passing a value to a variable like this:</p>
  
  <pre><code>var curId = $(this).attr('id');
  </code></pre>
  
  <p>I want to set the content of #result to a computation like this:</p>
  
  <p>$(#result).text(number * curId[0]);</p>
  
  <p>Number is a variable predefined by me, and curId[0] shoul actually translate to array1[0] or array2[0], depending on the css class.</p>
  
  <p>Can anyone tell me the right syntax for this? I'm pretty noob at js.
  Thanks.</p>