Shorthand for "function" keyword

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Nov 10 16:47:18 UTC 2017


An idiom that assigns names to arrow functions arguments:



```js
let add, mul; //used to name arrow functions

const sum = [1, 2, 3].reduce(add = (a, b) => a + b);
const product = [1, 2, 3].reduce(mul = (a, b) => a * b);
```





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171110/ab701691/attachment.html>


More information about the es-discuss mailing list