Created
October 13, 2015 16:51
-
-
Save jamischarles/9ad66a829f02600d471f to your computer and use it in GitHub Desktop.
es6 functions explained...
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
// method shorthand. ES6 version. | |
{ | |
initialize() {}, | |
doSomething() {} | |
} | |
// replaces (ES5) | |
{ | |
initialize: function() {}, | |
doSomething: function() {} | |
} | |
// arrow functions (bind 'this' properly. No more 'self = this' needed.) | |
(param1, param2) => {} | |
// replaces anon functions | |
function(param1, param2) {} | |
// because | |
() => {} === function() {}.bind(this) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment