title: Access to an array
body: <p>after a while I need your help again ;-). I found following javascript
      
      </p>
  
  <pre><code>var global_index = 0;
  var db = [ "10000000", "01000000", "00100000", "00010000", "00001000", "00000100", "00000010", "00000001" ];
  
  function loadled()
  {
      var byte = db[ global_index ];
      if( global_index &lt; 7 ) global_index++; else global_index = 0;
      for( var x = 0; x &lt; byte.length; x++ )
      {
          document.getElementById("id_" + x ).src = [ "led_off.gif", "led_on.gif" ][ parseInt( byte[ x ], 10 ) ];
      }
      window.setTimeout( loadled, 100 );
  }
  window.onload = loadled;
  
  &lt;/script&gt;&lt;/head&gt;  
  &lt;/html&gt;
  </code></pre>
  
  <p>I don't understand following line:</p>
  
  <pre><code>document.getElementById("id_" + x ).src = [ "led_off.gif", "led_on.gif" ][ parseInt( byte[ x ], 10 ) ];
  </code></pre>
  
  <p>Can anyone provide a simple explanation for this or a comparison to common writing?</p>
  
  <p>Thanks.</p>