From 59c786d32fbcf2df035b4046efed33be1754172f Mon Sep 17 00:00:00 2001 From: KK Tech Date: Sat, 21 Mar 2026 13:02:08 +0000 Subject: [PATCH 1/2] I have completed Debug/adress.js --- Sprint-2/debug/address.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-2/debug/address.js b/Sprint-2/debug/address.js index 940a6af83..7eda7d64b 100644 --- a/Sprint-2/debug/address.js +++ b/Sprint-2/debug/address.js @@ -1,4 +1,7 @@ // Predict and explain first... +//if you run this code with console.log('My house number is ${address[0]}'); it well log out 'My house number is undefined' becouse adress is an object and not an array. +// to fix this we need to remove (`My house number is ${address[0]}`); and chnage it to (adress.houseNumber) becouse we need to access the houseNumber property of the address object. +// Then it well log out 42 as expected. // This code should log out the houseNumber from the address object // but it isn't working... @@ -12,4 +15,4 @@ const address = { postcode: "XYZ 123", }; -console.log(`My house number is ${address[0]}`); +console.log(address.houseNumber); From 077f3e4783af9180a11160b38a1b192471919731 Mon Sep 17 00:00:00 2001 From: KK Tech Date: Sat, 21 Mar 2026 15:10:11 +0000 Subject: [PATCH 2/2] Completed Debug tasks --- Sprint-2/debug/author.js | 2 +- Sprint-2/debug/recipe.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Sprint-2/debug/author.js b/Sprint-2/debug/author.js index 8c2125977..7ba8f4c75 100644 --- a/Sprint-2/debug/author.js +++ b/Sprint-2/debug/author.js @@ -11,6 +11,6 @@ const author = { alive: true, }; -for (const value of author) { +for (const value of Object.values(author)) { console.log(value); } diff --git a/Sprint-2/debug/recipe.js b/Sprint-2/debug/recipe.js index 6cbdd22cd..0788c7620 100644 --- a/Sprint-2/debug/recipe.js +++ b/Sprint-2/debug/recipe.js @@ -10,6 +10,9 @@ const recipe = { ingredients: ["olive oil", "tomatoes", "salt", "pepper"], }; -console.log(`${recipe.title} serves ${recipe.serves} - ingredients: -${recipe}`); +console.log(recipe.title); +console.log(`Serves: ${recipe.serves}`); +console.log("Ingredients:"); +for (const ingredient of recipe.ingredients) { + console.log(ingredient); +}