I have created a for loop in JavaScript which looks like the following:
for (var i = 0; i < element[child].length; i++) {
...some code...
}
However when I run JSLint on it, it complains that the 'var i' should be moved to the beginning of the function (which seems odd to me to do) and it also complains that the ++ on the 'i++' is unexpected. It is this part that I really find weird - why is the ++ unexpected and what should it be replaced with?