Last active
March 2, 2018 10:23
-
-
Save brownsmith/33314048fd59aa5670587a1e5b4e4775 to your computer and use it in GitHub Desktop.
Arrow functions example
This file contains 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
// ES5 | |
var multiply = function(a, b) { | |
return a * b; | |
}; | |
// ES6 | |
var multiply = (a, b) => { return a * b }; | |
// even neater | |
var multiply = (a, b) => a * b; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Single params need no brackets
var func = x => x * x;
concise body syntax, implied "return"