Possible Duplicate:
Why avoid increment (“++”) and decrement (“--”) operators in JavaScript?
The “unexpected ++” error in jslint
jslint.com is giving me the error:
Unexpected '++'.
for this line:
for (i = 0; i < l; ++i) {
I tried i++
but no go.
JSLint does not like the increment and decrement operators. Replace it with i += 1
or add the plusplus: true
directive to the top of your file (if you're not sure how to set JSLint directives, here's an example. They are set in a normal comment at the top of your file):
/*jslint plusplus: true */
From the JSLint docs:
The
++
(increment) and--
(decrement) operators have been known to contribute to bad code by encouraging excessive trickiness. They are second only to faulty architecture in enabling to viruses and other security menaces.
Completely ridiculous rule? You can make your own mind up...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With