const _products = [
{'id': 1, 'title': 'iPad Mini 4', 'price': 500.01, 'inventory': 2},
{'id': 2, 'title': 'H&M T-Shirt White', 'price': 10.99, 'inventory': 10},
{'id': 3, 'title': 'Charli XCX - Sucker CD', 'price': 19.99, 'inventory': 5}
]
the inventory
and display the total amount?var inventorires = 0;
_products.forEach(function(product){
inventorires += product.inventory;
});
alert(inventorires);
Find more questions by tags JavaScript
- elliott.Cartwrig commented on June 8th 19 at 16:48
- nikolas.Reichert commented on June 8th 19 at 16:54