From c40984aa526b10b9051b026593f09c380fe29009 Mon Sep 17 00:00:00 2001 From: Fathi Kahin <127356471+fhkahin@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:22:51 +0000 Subject: [PATCH 1/6] exercise.js updated --- array-destructuring/exercise-1/exercise.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/array-destructuring/exercise-1/exercise.js b/array-destructuring/exercise-1/exercise.js index a6eab299..6ebaae44 100644 --- a/array-destructuring/exercise-1/exercise.js +++ b/array-destructuring/exercise-1/exercise.js @@ -4,10 +4,8 @@ const personOne = { favouriteFood: "Spinach", }; -function introduceYourself(___________________________) { +function introduceYourself({ name, age, favouriteFood }) { console.log( `Hello, my name is ${name}. I am ${age} years old and my favourite food is ${favouriteFood}.` ); } - -introduceYourself(personOne); From 90810bb8365f0acafc5271c940e28c5522645e66 Mon Sep 17 00:00:00 2001 From: Fathi Kahin <127356471+fhkahin@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:24:43 +0000 Subject: [PATCH 2/6] exercise 2 ompleted --- array-destructuring/exercise-2/exercise.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/array-destructuring/exercise-2/exercise.js b/array-destructuring/exercise-2/exercise.js index e11b75eb..47c6453a 100644 --- a/array-destructuring/exercise-2/exercise.js +++ b/array-destructuring/exercise-2/exercise.js @@ -70,3 +70,20 @@ let hogwarts = [ occupation: "Teacher", }, ]; + + +// Task 1 +console.log("Task 1:"); +hogwarts.forEach(({ firstName, lastName, house }) => { + if (house === "Gryffindor") { + console.log(`${firstName} ${lastName}`); + } +}); + +// Task 2 +console.log("\nTask 2:"); +hogwarts.forEach(({ firstName, lastName, occupation, pet }) => { + if (occupation === "Teacher" && pet) { + console.log(`${firstName} ${lastName}`); + } +}); From 7463459e9bee77ca6d5b081074b12b2dabfb0519 Mon Sep 17 00:00:00 2001 From: Fathi Kahin <127356471+fhkahin@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:25:52 +0000 Subject: [PATCH 3/6] exercise3 completed --- array-destructuring/exercise-3/exercise.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/array-destructuring/exercise-3/exercise.js b/array-destructuring/exercise-3/exercise.js index 0a01f8f0..c51576d9 100644 --- a/array-destructuring/exercise-3/exercise.js +++ b/array-destructuring/exercise-3/exercise.js @@ -6,3 +6,14 @@ let order = [ { itemName: "Hot Coffee", quantity: 2, unitPrice: 1.0 }, { itemName: "Hash Brown", quantity: 4, unitPrice: 0.4 }, ]; + +console.log("QUANTITY ITEM TOTAL"); +let totalCost = 0; + +order.forEach(({ itemName, quantity, unitPrice }) => { + let totalItemPrice = quantity * unitPrice; + totalCost += totalItemPrice; + console.log(`${quantity}\t${itemName.padEnd(20)}${totalItemPrice.toFixed(2)}`); +}); + +console.log(`\nTotal: ${totalCost.toFixed(2)}`); From 95ce14f1b5c0a79d769311a64c4cb5fe03470abf Mon Sep 17 00:00:00 2001 From: Fathi Kahin <127356471+fhkahin@users.noreply.github.com> Date: Wed, 14 Feb 2024 13:22:29 +0000 Subject: [PATCH 4/6] index.html completed --- programmer-humour/index.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 programmer-humour/index.html diff --git a/programmer-humour/index.html b/programmer-humour/index.html new file mode 100644 index 00000000..14990ee8 --- /dev/null +++ b/programmer-humour/index.html @@ -0,0 +1,23 @@ + + +
+ + + +