Answer the question
In order to leave comments, you need to log in
JS: Coincidence of the name of a function parameter and the name of a local variable in the function that called it - an anti-pattern?
Good afternoon, is
the coincidence of the name of a function parameter and the name of a local variable in the function that called it an antipattern?
function bigFoo () {
var x = 100;
return x = smallFoo(x);
}
function smallFoo(x) {
return x+=10;
}
bigFoo();
Answer the question
In order to leave comments, you need to log in
The variable names are the same, but their scopes and, accordingly, their references are different.
This is not an anti-pattern.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question