Last active
October 7, 2015 16:52
-
-
Save adrianoschmidt/702dc06d9d7321600fb8 to your computer and use it in GitHub Desktop.
Map e Reduce em JavaScript - Post http://localhost8080.blogspot.com.br/2015/10/map-e-reduce-em-javascript.html
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
// 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