Forked from ryanflorence/gist:023b84f2002a39ae6c53
Last active
August 29, 2015 14:15
-
-
Save davidbgk/1c3a5307a3f1a2fdbc20 to your computer and use it in GitHub Desktop.
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
// declaration | |
function foo (n) { return n + 1; } | |
// expression | |
// note, fat arrow functions have very different meaning (usually what I want, though) | |
var foo = function (n) { return n + 1; }; | |
var foo = (n) => { return n + 1; }; | |
var foo = n => n + 1; | |
// object methods | |
var obj = { | |
// these are just expressions, but to some beginners they seem different | |
foo: function (n) { return n + 1; }, | |
foo: (n) => { return n + 1; }, | |
foo: n => n + 1, | |
// concise method | |
foo () {} | |
} | |
class foo {} // <-- actually just a function | |
class Thing { | |
foo () {} // <-- no comma | |
bar () {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment