Other ways to increment a variable in JavaScript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/971312/why-avoid-increment-and-decrement-operators-in-javascript">Why avoid increment (&ldquo;++&rdquo;) and decrement (&ldquo;--&rdquo;) operators in JavaScript?</a>  </p>
</blockquote>



<p>I'm a big fan of Douglas Crockford and his excellent book, <a href="http://www.amazon.co.uk/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/" rel="nofollow">JavaScript: The Good Parts</a>. I also use his <a href="http://www.jslint.com" rel="nofollow">JSLint</a> tool on an hourly basis before checking in any code to our repository, as is good sense.</p>

<p>One thing I've noticed when running code through JSLint is its insistence that the ++ increment operator is somehow evil. I know I can turn certain rules off, but that's cheating ;). Crockford mentions his dislike on page 112 of JS: TGP...</p>

<blockquote>
  <p>In my own practice, I observed that when I used ++ and --, my code tended to be too tight, too tricky, too cryptic. So, as a matter of discipline, I don't use them any more. I think that as a result, my coding style has become cleaner.</p>
</blockquote>

<p>That's all very lovely, but he doesn't give any examples of the way he codes them now. I assume he's doing something like...</p>

<pre><code>var i;
i = 0;
i = i + 1;
</code></pre>

<p>Again, great, but I've got a few basic 'for loops' in my JS code, as I imagine many people have, and I've always used the standard syntax...</p>

<pre><code>for (i = 0; i &lt; myArray.length; i++) { 
    // Loop Stuff 
}
</code></pre>

<p>Am I missing something? What's the cleanest and/or best way to increment/decrement?</p>
