title: Define looping condition array/object in syntax For loop
body: <p>When I loop an array or object I frequently use this way:</p>
  
  <pre><code>var arrCars = ["opel" , "audi" , "volvo" , "volkswagen" , 
                "renault" , "porsche" , "infinity" , "lexus"];
  
  for (var i = 0, a; a = arrCars[i]; i++) {
    alert(a);
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/L9mPj/" rel="nofollow noreferrer">fiddle</a></p>
  
  <p>It gives clear short code in my opinion instead of e.g. this:</p>
  
  <pre><code>for (var i = 0; i &lt; arrCars.length; i++) {
    alert(arrCars[i]);
  }
  </code></pre>
  
  <p>In this example it isn't a big issue but when there are some nested objects etc. it gives a lot code.</p>
  
  <p>There are many syntax possibilities like you can see under this question <a href="https://stackoverflow.com/questions/3010840/loop-through-array-in-javascript">here</a>. But I still can't find out how I can loop trough a part of an array. For example, how can I loop only the first 3 values with my preferred syntax. Ofcourse i can use an extra condition statement, but I'm wondering how I can include this condition in the for syntax itself like: "<em>for (var i = 0;</em> <strong>i &lt; 4;</strong> <em>i++){}</em>" if it's possible ofcourse.</p>