I would like to refactor a variable inside a function, but only inside that function. Is this possible in the JetBrains IDE's?
Example:
var global = 0;
function func1 (val) {
if (val === global) {
doSomething();
} else if (val * 2 === global) {
doSomethingElse();
} else {
doSomethingElseEntirely();
}
}
function func2 (val) {
if (val === global) {
doSomething();
} else if (val * 2 === global) {
doSomethingElse();
} else {
doSomethingElseEntirely();
}
}
If I try to change the variable global
inside func1
via refactor, it will be changed in all of globals scope, so in func2
as well. I would like to prevent this. Is this possible?