Consider the following snippet:
const returnsFunc = () => (arg0, arg1) => {
console.log('arguments: ' + JSON.stringify(arguments));
console.log('arg0: ' + arg0 + ' ' + JSON.stringify(arguments[0]));
console.log('arg1: ' + arg1 + ' ' + JSON.stringify(arguments[1]));
};
returnsFunc()(1, 2);
The output is as follows:
arguments: {"0":{"isTrusted":true}}
(index):48 arg0: 1 {"isTrusted":true}
(index):49 arg1: 2 undefined
So the arguments
variable for the function being returned from returnsFunc
is being shadowed.
Is there a way to access the shadowed arguments
variable?