I've been running JSLint over some code, and dealing with some of the issues it throws up. One of those was
Unexpected 'for'.
The code has to work over different subsets of an array, depending on what the user has asked for. As an example we might have
myArray = [1,2,3,4,5,6,7,8,9];
let start = 4;
let finish = 8;
let i;
for (i=start; i<finish;i++) {
// Do stuff with myArray[4] to myArray[7]
}
What is JSLint's objection to this construction?
How would I achieve that without using a for loop?
Note: I know I could disable the warning in JSLint, or that I could simply ignore the warning, but that just circumvents the issue.