I read Is there a performance difference between i++ and ++i in C?:
Is there a performance difference between
i++and++iif the resulting value is not used?
What’s the answer for JavaScript?
For example, which of the following is better?
-
for (var i = 0; i < max; i++) { // code } -
for (var i = 0; i < max; ++i) { // code }
Here is an article about this topic: http://jsperf.com/i-vs-i/2
++iseems to be slightly faster (I tested it on firefox) and one reason, according to the article, is: