The variables should be declared at the top of the function because that's what JavaScript ends up doing anyway (it's known as "variable hoisting"), so JSLint thinks it's clear to always have them there.
Regarding i++
, it wants you to use i += 1
. From 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. Also, preincrement/postincrement confusion can produce off-by-one errors that are extremely difficult to diagnose. There is a plusplus option that allows the use of these operators.
In short, JSLint believes it's evil, which is controversial. See also: http://jslinterrors.com/unexpected-plus-plus/