Created
July 19, 2017 23:36
-
-
Save caioregatieri/40f617ba3c9431debad3e2009cc6ede9 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
const produtos = [{ | |
nome: 'Bicicleta', | |
preco: 1200.0 | |
}, { | |
nome: 'Capacete', | |
preco: 450.0 | |
}] | |
var apenasPrecos = (produto) => produto.preco; | |
var soma = (inicio, preco) => inicio + preco; | |
console.log(produtos.map(apenasPrecos).reduce(soma)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certinho