JSLint will throw the "Unexpected '++'" error when it encounters the use of the increment operator ++. It will throw the related "Unexpected '--'" error when it encounters the use of the decrement operator ++ Here's an example:
This error message is perhaps the most debated of all JSLint error messages. It exists solely to warn you that JSLint has encountered a violation of a specific coding style, in particular, the style of the author of JSLint, Douglas Crockford. For his reasoning, you can read the JSLint documentation:
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. Also, preincrement/postincrement confusion can produce off-by-one errors that are extremely difficult to diagnose.
There are many JavaScript developers who disagree with that, but the fact remains, it's a rule in JSLint so you need a way to work around it. What JSLint would prefer you to do is use the normal addition and subtraction operators, which can be combined with the assignment operator for a slight decrease in length:
If you would prefer not to do that, and would rather stick with the normal increment and decrement operators, you can set the plusplus option to true to tell JSLint to allow them: