Inspectopedia Help

Indexed 'for' is used instead of 'for..of'

Reports an indexed <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for">for</a> loop used on an array. Suggests replacing it with a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of">for..of</a> loop.

for..of loops are introduced in ECMAScript 6 and iterate over iterable objects.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

ES6ConvertIndexedForToForOf
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | JavaScript and TypeScript | ES2015 migration aids

Last modified: 11 September 2024