From c363dbbf20c408e5e5f3efc8152c904e3ac27038 Mon Sep 17 00:00:00 2001 From: LSvekis Date: Thu, 27 May 2021 16:47:29 -0400 Subject: [PATCH] Update Chapter 3 Exercises --- Chapter 3 Exercises | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Chapter 3 Exercises b/Chapter 3 Exercises index 8194811..1a1ec19 100644 --- a/Chapter 3 Exercises +++ b/Chapter 3 Exercises @@ -95,3 +95,32 @@ myArr3.sort(); myArr3.length = 0; console.log(myArr3[0]); //What is output in the console. + + +Final Project +const inventory = []; +const item3 = { + name: 'computer', + model: 'imac', + cost: 1000, + qty: 3 +} +const item2 = { + name: 'phone', + model: 'android', + cost: 500, + qty: 11 +} +const item1 = { + name: 'tablet', + model: 'ipad', + cost: 650, + qty: 1 +} +inventory.push(item1, item2, item3); +console.log(inventory); +let total = 0; +inventory.forEach(el => { + total += el.qty; +}) +console.log(total);