Skip to content

Instantly share code, notes, and snippets.

@wescleymatos
Created July 20, 2017 00:43
Show Gist options
  • Save wescleymatos/a1b93e81c40988b8489270060b0c868e to your computer and use it in GitHub Desktop.
Save wescleymatos/a1b93e81c40988b8489270060b0c868e to your computer and use it in GitHub Desktop.
const produtos = [
{
nome: 'Bicicleta',
preco: 1200.0
},
{
nome: 'Capacete',
preco: 450.0
}
]
let somaPreco = produtos.reduce((anterior, atual) => anterior + atual.preco, 0)
console.log(somaPreco)
@tuliofaria
Copy link

Certinho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment