arguments
isn't available in arrow functions, and this affects how function parameters should be consistently treated in ES6.
If original parameter is used, it should be destructured inside function:
(param) => {
const {name, value} = param;
// ...
}
If several arguments are expected and some argument negotiation takes place (for example, similarly to arguments.length
), rest parameter should be used:
(...args) => {
const [param] = args;
// ...
}
Boilerplate variable destructuring has its benefits; it's easier this way to debug param
or args
at breakpoint even if they aren't currently in use.