Inspectopedia Help

Referencing mutable variable from closure

Reports access to outer mutable variables from functions.

Example:

for (var i = 1; i <= 3; i++) { setTimeout(function() { console.log(i); // bad }, 0); }

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.

JSReferencingMutableVariableFromClosure
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 | General

Last modified: 11 September 2024