All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.javascript.rules.javascript.S4139.html Maven / Gradle / Ivy

There is a newer version: 10.17.0.28100
Show newest version

Why is this an issue?

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);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy