The analyzer has detected a for loop where the initial and final values of the iterator are the same. This looks like a typo. As a result, the loop either won't execute or will execute only once.
The example:
function copy_range(src, dst, from, to) {
for (let i = from; i < from; i++) {
dst[i] = src[i];
}
}
The function should copy the elements in the from to to range between the collections. In reality, the loop body never executes: the i < from condition is false, since i starts at from. This is a typo, and the condition should use a different variable—in this case, to.
The fixed code:
function copy_range(src, dst, from, to) {
for (let i = from; i < to; i++) {
dst[i] = src[i];
}
}
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: