Skip to content

Instantly share code, notes, and snippets.

@getify
Last active February 25, 2020 11:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save getify/decc32526a241c586bac134c713e0f0d to your computer and use it in GitHub Desktop.
Save getify/decc32526a241c586bac134c713e0f0d to your computer and use it in GitHub Desktop.
exploring readability differences
let names = people.map(personToGetNameFrom => personToGetNameFrom.name);
// ******************
let getName = person => person.name;
let names = people.map(getName);
// ******************
function getName(person) { return person.name; }
let names = people.map(getName);
// *****************
let names = people.map(function getName(person){ return person.name; });
// *****************
let names = people.map(prop("name"));
// **********************************************
// **********************************************
// **********************************************
function getNames(people) { /* ... */ }
let names = getNames(people);
// *****************
let getNames = map(prop("name"));
let names = getNames(people);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment