Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Sprint-2/debug/address.js
Original file line number Diff line number Diff line change
@@ -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...
Expand All @@ -12,4 +15,4 @@ const address = {
postcode: "XYZ 123",
};

console.log(`My house number is ${address[0]}`);
console.log(address.houseNumber);
2 changes: 1 addition & 1 deletion Sprint-2/debug/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ const author = {
alive: true,
};

for (const value of author) {
for (const value of Object.values(author)) {
console.log(value);
}
9 changes: 6 additions & 3 deletions Sprint-2/debug/recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}