Last active
August 29, 2015 14:16
-
-
Save jaspervalero/d0acc37553b3d3c8fd8e to your computer and use it in GitHub Desktop.
ES6 Arrow Function Expression Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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