title: Dealing with duplicate declaration warning for loop variables
body: <p>Consider the following code:</p>
  
  <pre><code>for (var i=0; i&lt;100; i++) {
      // your code here
  }
  // some other code here
  for (var i=0; i&lt;500; i++) {
      // custom code here
  }
  </code></pre>
  
  <p>Any decent lint tool (jslint, jshint or built in IDE) will tell warning - <code>duplicate declaration of variable i</code>. This can be solved by using variable with another name (<code>k</code>, <code>j</code>) or moving declaration to the top:</p>
  
  <pre><code>var i; // iterator
  for (i=0; i&lt;100; i++) {}
  for (i=0; i&lt;500; i++) {}
  </code></pre>
  
  <p>I am not fond of both variants - I don't make declarations at the top usually (and even if I did I wouldn't want see there helper variables - <code>i</code>, <code>j</code>, <code>k</code>) and really nothing bad is going on in those examples to change variables' names for.</p>
  
  <p>Though I do want a huge warning in case I write something like this:</p>
  
  <pre><code>for (var i=0; i&lt;100; i++) {
      for (var i=0; i&lt;500; i++) {} // now that's bad
  }
  </code></pre>
  
  <p>What's your approach to such cases?</p>