(() => console.log(arguments))(1,2,3);
// Chrome, FF, Node give "1,2,3"
// Babel gives "arguments is not defined" from parent scope
According to Babel (and from what I can tell initial TC39 recommendations), that is "invalid" as arrow functions should be using their parent scope for arguments. The only info I've been able to find that contradicts this is a single comment saying this was rejected by TC39, but I can't find anything to back this up.
Just looking for official docs here.
Chrome, FF, and node seem to be wrong here, Babel is correct:
Arrow functions do not have an own
arguments
binding in their scope; no arguments object is created when calling them.Arrow function expressions evaluate to functions that have their [[ThisMode]] set to
lexical
, and when such are called the declaration instantiation does not create anarguments
object. There is even a specifc note (18 a) stating that "Arrow functions never have an arguments objects.".