Skip to content

Instantly share code, notes, and snippets.

@jamischarles
Created October 13, 2015 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamischarles/9ad66a829f02600d471f to your computer and use it in GitHub Desktop.
Save jamischarles/9ad66a829f02600d471f to your computer and use it in GitHub Desktop.
es6 functions explained...
// 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