en.javascript.info
en.javascript.info copied to clipboard
Improved arrow function arguments example
The updated example better demonstrates how arguments behaves inside arrow functions. In the previous example, the arrow function was invoked without passing its own parameters, so it wasn’t obvious that arguments inside an arrow function refers to the arguments of the outer normal function.
In the new example, we explicitly pass a parameter ("Hii") to the arrow function, and also log arguments[0] inside it. This makes it clear that arguments[0] is still taken from the outer function (1) and not from the arrow function’s own parameter list, illustrating the lexical binding behavior of arguments in arrow functions.