From 3724597d8a328684f6d2d0d94a2b70c5a0e4a479 Mon Sep 17 00:00:00 2001 From: Rizqah Date: Wed, 5 Aug 2026 23:08:03 +0100 Subject: [PATCH 1/5] exercise 1 done --- Sprint-1/destructuring/exercise-1/exercise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-1/destructuring/exercise-1/exercise.js b/Sprint-1/destructuring/exercise-1/exercise.js index 1ff2ac5c..d86bc7bf 100644 --- a/Sprint-1/destructuring/exercise-1/exercise.js +++ b/Sprint-1/destructuring/exercise-1/exercise.js @@ -6,7 +6,7 @@ const personOne = { // Update the parameter to this function to make it work. // Don't change anything else. -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}.` ); From ab64a60b7553cb8847476c264156529485fcbaa5 Mon Sep 17 00:00:00 2001 From: Rizqah Date: Wed, 5 Aug 2026 23:08:48 +0100 Subject: [PATCH 2/5] exercise 2 done --- Sprint-1/destructuring/exercise-2/exercise.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sprint-1/destructuring/exercise-2/exercise.js b/Sprint-1/destructuring/exercise-2/exercise.js index e11b75eb..b41cba33 100644 --- a/Sprint-1/destructuring/exercise-2/exercise.js +++ b/Sprint-1/destructuring/exercise-2/exercise.js @@ -70,3 +70,14 @@ let hogwarts = [ occupation: "Teacher", }, ]; +for (const { house, firstName, lastName } of hogwarts) { + if (house === "Gryffindor") { + console.log(`${firstName} ${lastName}`); + } + + for (const { pets, firstName, lastName } of hogwarts) { + if (house !== null) { + console.log(`${firstName} ${lastName}`); + } + } +} From 89a532e3440acb852fa5ebfd96fdd19a863758d9 Mon Sep 17 00:00:00 2001 From: Rizqah Date: Wed, 5 Aug 2026 23:55:24 +0100 Subject: [PATCH 3/5] exercise 3 done --- Sprint-1/destructuring/exercise-3/exercise.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sprint-1/destructuring/exercise-3/exercise.js b/Sprint-1/destructuring/exercise-3/exercise.js index b3a36f4e..4aa1e873 100644 --- a/Sprint-1/destructuring/exercise-3/exercise.js +++ b/Sprint-1/destructuring/exercise-3/exercise.js @@ -6,3 +6,18 @@ let order = [ { itemName: "Hot Coffee", quantity: 2, unitPricePence: 100 }, { itemName: "Hash Brown", quantity: 4, unitPricePence: 40 }, ]; + +let total = 0; + +console.log("QTY ITEM TOTAL"); + +for (const { itemName, quantity, unitPricePence } of order) { + const itemTotal = quantity * unitPricePence; + total += itemTotal; + + console.log( + `${quantity} ${itemName.padEnd(20)}${(itemTotal / 100).toFixed(2)}` + ); +} + +console.log(`\nTotal: ${(total / 100).toFixed(2)}`); From de7f576ec83d1af0fdad6974276093f30cb6e516 Mon Sep 17 00:00:00 2001 From: Rizqah Date: Sat, 8 Aug 2026 11:46:21 +0100 Subject: [PATCH 4/5] teacher destructuring fixed --- Sprint-1/destructuring/exercise-2/exercise.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Sprint-1/destructuring/exercise-2/exercise.js b/Sprint-1/destructuring/exercise-2/exercise.js index b41cba33..d2623a88 100644 --- a/Sprint-1/destructuring/exercise-2/exercise.js +++ b/Sprint-1/destructuring/exercise-2/exercise.js @@ -70,14 +70,13 @@ let hogwarts = [ occupation: "Teacher", }, ]; -for (const { house, firstName, lastName } of hogwarts) { - if (house === "Gryffindor") { - console.log(`${firstName} ${lastName}`); - } +// for (const { house, firstName, lastName } of hogwarts) { +// if (house === "Gryffindor") { +// console.log(`${firstName} ${lastName}`); +// } - for (const { pets, firstName, lastName } of hogwarts) { - if (house !== null) { - console.log(`${firstName} ${lastName}`); - } +for (const { occupation, pets, firstName, lastName } of hogwarts) { + if (occupation === "Teacher" && pets !== null) { + console.log(`${firstName} ${lastName}`); } } From 214df02c962ea1864957cd40e2f9a3ff6954c5e7 Mon Sep 17 00:00:00 2001 From: Rizqah Date: Sat, 8 Aug 2026 11:47:13 +0100 Subject: [PATCH 5/5] fixed --- Sprint-1/destructuring/exercise-2/exercise.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Sprint-1/destructuring/exercise-2/exercise.js b/Sprint-1/destructuring/exercise-2/exercise.js index d2623a88..b3dde657 100644 --- a/Sprint-1/destructuring/exercise-2/exercise.js +++ b/Sprint-1/destructuring/exercise-2/exercise.js @@ -70,13 +70,14 @@ let hogwarts = [ occupation: "Teacher", }, ]; -// for (const { house, firstName, lastName } of hogwarts) { -// if (house === "Gryffindor") { -// console.log(`${firstName} ${lastName}`); -// } - -for (const { occupation, pets, firstName, lastName } of hogwarts) { - if (occupation === "Teacher" && pets !== null) { +for (const { house, firstName, lastName } of hogwarts) { + if (house === "Gryffindor") { console.log(`${firstName} ${lastName}`); } + + for (const { occupation, pets, firstName, lastName } of hogwarts) { + if (occupation === "Teacher" && pets !== null) { + console.log(`${firstName} ${lastName}`); + } + } }