Skip to content

Instantly share code, notes, and snippets.

@marcaosi
Created July 19, 2017 12:53
Show Gist options
  • Save marcaosi/1fe8f8824f9383ec8bf73ca7216f229a to your computer and use it in GitHub Desktop.
Save marcaosi/1fe8f8824f9383ec8bf73ca7216f229a to your computer and use it in GitHub Desktop.
const produtos = [
{
nome: 'Bicicleta',
preco: 1200.0
},
{
nome: 'Capacete',
preco: 450.0
}
]
console.log(produtos.reduce((valorAnterior, proximoValor) => valorAnterior + proximoValor.preco, 0));
@tuliofaria
Copy link

Certinho.

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