Off topic: The design decision in ES2015 to have lexical `arguments` [1] in arrow functions completely baffled me and my coworkers. It completely breaks the contract that most people think arrow functions abide by, which is that it's a simple transformation to `function() { ... }.bind(this)`.
function foo() {
const bar = (a, b, c) => {
console.log([a, b, c]);
console.log(arguments);
};
bar('a', 'b', 'c');
}
> foo('x', 'y', 'z');
['a', 'b', 'c']
{ '0': 'x', '1': 'y', '2': 'z' }
In realistic cases it's common to switch to arrow functions just for their brevity or to capture `this` – and then all of a sudden things aren't doing what you expect. This has already bitten me several times.[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...