Skip to content

Instantly share code, notes, and snippets.

@whichsteveyp
Created March 10, 2015 17:54
Show Gist options
  • Save whichsteveyp/0f979042a1cf00221292 to your computer and use it in GitHub Desktop.
Save whichsteveyp/0f979042a1cf00221292 to your computer and use it in GitHub Desktop.
I was not aware of the two syntax styles here. Are there valid uses/reasons for both?
// one
[].each(function (foo) {
return foo.info ? "hello" : "hi";
});
// two
[].each(function (foo) {
return foo.info ? "hello" : "hi";
});
// three
[].each(function (foo) {
foo.info ? "hello" : "hi";
});
// one
[].each(foo => foo.info ? 'hello' : 'hi');
// two
[].each((foo) => { return foo.info ? 'hello' : 'hi'; });
// three
[].each((foo) => { foo.info ? 'hello' : 'hi'; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment