Skip to content

Instantly share code, notes, and snippets.

@elyssonmr
Created July 20, 2017 00:16
Show Gist options
  • Save elyssonmr/a93ec612150477eef9c80076f23d0aaf to your computer and use it in GitHub Desktop.
Save elyssonmr/a93ec612150477eef9c80076f23d0aaf to your computer and use it in GitHub Desktop.
Exercício1
const produtos = [
{
nome: 'Bicicleta',
preco: 1200.0
},
{
nome: 'Capacete',
preco: 450.0
}
]
const valores = produtos.map(produto => produto.preco)
const soma = (anterior, atual) => anterior + atual
const total = valores.reduce(soma, 0)
console.log(total)
@tuliofaria
Copy link

Certinho

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