JSHint complains if I have multiple for loops declaring the same index variable:
for(var i=0; i<10; i++){
console.log(i);
}
for(var i=0; i<10; i++){ //<-- jshint warns that 'i' is already defined
console.log(i);
}
Is there a way to turn this warning off? I couldn't find any when I searched...
The reason I want to do this is that I prefer keeping my index variables declared together with the loops instead of hoisting the declarations to the top of the function. I think repeating the declarations is more robust if I delete the for loops or move them around and I also think it helps convey the intention that the loop variables should not be used outside the loops.