Last active
August 3, 2017 11:38
-
-
Save jeyziel/d432b97d70fd1ffbdea6527ef6103dd9 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 | |
} | |
] | |
const soma = ( anterior, atual ) => anterior + atual | |
const somaTotal = produtos.map( produtos => produtos.preco ).reduce( soma, 0 ) | |
console.log(somaTotal) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certinho.