Skip to content

Instantly share code, notes, and snippets.

@adrianoschmidt
Last active October 7, 2015 16:52
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 adrianoschmidt/702dc06d9d7321600fb8 to your computer and use it in GitHub Desktop.
Save adrianoschmidt/702dc06d9d7321600fb8 to your computer and use it in GitHub Desktop.
// map
var idList = list.map(function(entity) {
return entity.id;
});
// reduce
var valueTotal = list.reduce(function(valueTotal, entity) {
return valueTotal + entity.value;
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment