If you have an iterable, such as an array, set, or list, your best option for looping through its values is the for of syntax. Use for in and you'll iterate the properties, rather than the values.

Noncompliant Code Example

const arr = [4, 3, 2, 1];

for (let value in arr) {  // Noncompliant
  console.log(value);  // logs 0, 1, 2, 3
}

Compliant Solution

const arr = [4, 3, 2, 1];

for (let value of arr) {
  console.log(value);
}