Normally, a function can access itself like this:
(function f() {
console.log(f); // Prints the function definition
}());
However, when the function f has an argument also called f, the argument takes precedence:
(function f(f) {
console.log(f); // Prints 1
}(1));
In the second example, how can I access the function when one of the arguments has the same name as the function?
[Also, where can I find the documentation saying that the argument should take precedence over the function name?]
You don’t. Just follow this simple rule
Note:
arguments.calleewill work for this, but only in some implentations. And it’s actually being phased out and is likely to disappear completely in the future.