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"