Skip to content

Instantly share code, notes, and snippets.

@jaspervalero
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save jaspervalero/d0acc37553b3d3c8fd8e to your computer and use it in GitHub Desktop.

Select an option

Save jaspervalero/d0acc37553b3d3c8fd8e to your computer and use it in GitHub Desktop.
ES6 Arrow Function Expression Example
// Multiple statements
([param] [,param]) => {
statements
}
// Single expression
param => expression
/* _____ Examples _____ */
// No arguments, must use ()
var noArgs = () => {
// Do something
};
// Only one argument, () and {} are optional
var oneArg = param1 => // Do something with param1
// Multiple arguments, must use ()
var multiArgs = ( param1, param2, param3 /* ... */ ) => {
// Do something with param1, param2, param3 and so on
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment