Created
July 20, 2017 03:48
-
-
Save lucasdu4rte/7ae1ed2c943d977aa6a73085173fb3cf to your computer and use it in GitHub Desktop.
Exercicio 2b
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 = [ | |
{ | |
id: 1, | |
preco: 10.0, | |
qtd: 2 | |
}, | |
{ | |
id: 2, | |
preco: 10.0, | |
qtd: 6 | |
}, | |
{ | |
id: 3, | |
preco: 10.0, | |
qtd: 8 | |
}, | |
{ | |
id: 4, | |
preco: 10.0, | |
qtd: 20 | |
} | |
] | |
var subtotais = produtos.map(function(produto) { | |
return {id: produto.id, subtotal: produto.preco*produto.qtd} | |
}) | |
console.log(subtotais) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment