Skip to content

Instantly share code, notes, and snippets.

@andilabs
Created September 8, 2017 13:52
Show Gist options
  • Save andilabs/64136beaf4b7fd0a7a7b5d0a1a89dde6 to your computer and use it in GitHub Desktop.
Save andilabs/64136beaf4b7fd0a7a7b5d0a1a89dde6 to your computer and use it in GitHub Desktop.
// Parenthesize the body of function to return an object literal expression:
params => ({foo: bar})
// Rest parameters and default parameters are supported
(param1, param2, ...rest) => { statements }
(param1 = defaultValue1, param2, …, paramN = defaultValueN) => { statements }
// Destructuring within the parameter list is also supported
let f = ([a, b] = [1, 2], {x: c} = {x: a + b}) => a + b + c;
f();
// 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment