t1
and t2
returns a function in different way, a normal function or an arrow function:
function t1(fn) {
return async function() {
console.log(arguments);
}
}
function t2(fn) {
return async () => {
console.log(arguments);
}
}
t1('t1: outer arg')('t1: inner arg');
t2('t2: outer arg')('t2: inner arg');
This surprised me, because I thought the normal form of the function and the arrow function notations are inter-exchangeable almost.
$ node arguments_scope.js
[Arguments] { '0': 't1: inner arg' }
[Arguments] { '0': 't2: outer arg' }
Why?