title: Having problems understanding the result mixing "For loops" and "array" (beginner)
body: <p>I'm currently studying javascript and I don't understand the result based on a specific condition. Thanks for you patience with newbies like myself ;)</p>
  
  <p>In the following case, I don't understand why the last line "blue" is displayed since the condition is "show only when counter > 0".</p>
  
  <pre><code>var table = ['blue','yellow','orange','red'];
  for (var counter = table.length ; counter &gt; 0 ; counter--)
  {
  document.write(table[counter-1] + "&lt;br&gt;")
  }
  </code></pre>
  
  <p>Another way to see the result would be :</p>
  
  <pre><code>var table = ['blue','yellow','orange','red'];
  document.write(table[table.length-1] + '&lt;br&gt;'); // result: table[3] "red"
  document.write(table[table.length-2] + '&lt;br&gt;'); // result: table[2] "orange"
  document.write(table[table.length-3] + '&lt;br&gt;'); // result: table[1] "yellow"
  document.write(table[table.length-4] + '&lt;br&gt;'); // result: table[0] "blue" = should not be displayed if we have the condition 'counter &gt; 0'
  </code></pre>
  
  <p>Thanks for your help!</p>