The analyzer has detected that the code accesses the same collection element on every iteration of a for loop using a constant index.
The example:
let sum = 0;
for (let i = 0; i < arr.length; i++) {
sum += arr[0]; // <=
}
In this case, it is intended to sum all elements of the array, but the index contains a typo. As a result, only the first array element is used, and the values of the other elements are ignored.
The fixed code:
let sum = 0;
for (let i = 0; i < arr.length; i++) {
sum += arr[i];
}
You can look at examples of errors detected by the V7016 diagnostic. |
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: