Skip to main content

Hides declaration from the outer scope

In This Article

Note

The Hides declaration from the outer scope code issue is JavaScript specific.

CodeRush Classic shows the Hides declaration from the outer scope code issue if a local variable has the same name as an outer scope declaration.

#Fix

Rename the local variable.

#Purpose

Highlights the declaration that hides the outer scope declaration with the same name, which should be renamed to make your code more clear.

#Example

var clicks;
function GetClicksCount() {
  var clicks = GetClicks();
  return ProcessClicks(clicks);
}

Fix:

var clicks;
function GetClicksCount() {
  var locClicks = GetClicks();
  return ProcessClicks(locClicks);
}