Possible Duplicate:
  Why avoid increment (&ldquo;++&rdquo;) and decrement (&ldquo;--&rdquo;) operators in JavaScript?  




I'm a big fan of Douglas Crockford and his excellent book, JavaScript: The Good Parts. I also use his JSLint tool on an hourly basis before checking in any code to our repository, as is good sense.

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...


  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.


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...

var i;
i = 0;
i = i + 1;


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...

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


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


Question: Vector fields whose divergence are proper maps
Answer: Since $\mathbb R^2$ has one end and $\mathbb R^1$ has two ends, a proper map $\mathbb R^2 \to \mathbb R^1$ must send the end of $\mathbb R^2$ to one of the two ends of $\mathbb R^1$ - that is, $f(x,y)$ is either a large positive number of a large negative number when $(x,y)$ is large.

But we can force $\nabla \cdot gX$ to oscillate  arbitrarily many times. Choose a vector field like $ \sin(x^2+y^2)( xdx + ydy)$. Then the integral of the divergence over a disc is the integral of the vector field dot the normal vector over a circle, which switches sign periodically in the radius of the function, so the divergence must switch sign arbitrarily often, so it can't be proper.

Moreover because it switches sign with arbitrarily large radius, the set where it is 0 cannot be compact.