Skip to content

Commit ec33971

Browse files
committed
Work on debug
1 parent de6889c commit ec33971

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

‎Sprint-2/debug/address.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// Predict and explain first...
2+
// I think that it will not run because we're trying to access an object on line 15
3+
// Instead it should be ${adddress[houseNumber]}
24

35
// This code should log out the houseNumber from the address object
46
// but it isn't working...
@@ -12,4 +14,4 @@ const address = {
1214
postcode: "XYZ 123",
1315
};
1416

15-
console.log(`My house number is ${address[0]}`);
17+
console.log(`My house number is ${address["houseNumber"]}`);

‎Sprint-2/debug/author.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// Predict and explain first...
2+
// Because it's trying to iterate through an object
3+
// It should just print author without a loop
24

35
// This program attempts to log out all the property values in the object.
46
// But it isn't working. Explain why first and then fix the problem
@@ -11,6 +13,4 @@ const author = {
1113
alive: true,
1214
};
1315

14-
for (const value of author) {
15-
console.log(value);
16-
}
16+
console.log(author);

‎Sprint-2/debug/recipe.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// Predict and explain first...
2+
// I think it should use recipe.ingredients instead of recipe at line 15
3+
// Ok I tried it and now I think that it should be done with a loop to list the ingredients
24

35
// This program should log out the title, how many it serves and the ingredients.
46
// Each ingredient should be logged on a new line
@@ -11,5 +13,8 @@ const recipe = {
1113
};
1214

1315
console.log(`${recipe.title} serves ${recipe.serves}
14-
ingredients:
15-
${recipe}`);
16+
ingredients:`);
17+
18+
for (const i of recipe.ingredients) {
19+
console.log(i);
20+
}

0 commit comments

Comments
 (0)