Update Chapter 3 Exercises
This commit is contained in:
parent
fe763b45d9
commit
c363dbbf20
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user