Skip to content

Commit 9d50109

Browse files
committed
Sprint 2 coursework debug section is done
1 parent 4fe9c3a commit 9d50109

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎Sprint-2/debug/address.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Predict and explain first...
2-
2+
// i think its because the address is not used as an array but as an object
33
// This code should log out the houseNumber from the address object
44
// but it isn't working...
55
// Fix anything that isn't working
@@ -12,4 +12,4 @@ const address = {
1212
postcode: "XYZ 123",
1313
};
1414

15-
console.log(`My house number is ${address[0]}`);
15+
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,8 +1,8 @@
11
// Predict and explain first...
2-
2+
//i think its because value is not used as a parameter of an object, and author is an object not an ordered list Array.
33
// This program attempts to log out all the property values in the object.
44
// But it isn't working. Explain why first and then fix the problem
5-
5+
// i found that object literals are not iterative because they have no orders
66
const author = {
77
firstName: "Zadie",
88
lastName: "Smith",
@@ -11,6 +11,6 @@ const author = {
1111
alive: true,
1212
};
1313

14-
for (const value of author) {
14+
for (const value of Object.values(author)) {
1515
console.log(value);
1616
}

‎Sprint-2/debug/recipe.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Predict and explain first...
2-
2+
/*
3+
console.log(`${recipe.title} serves ${recipe.serves}
4+
ingredients:
5+
${recipe}`);// here it misses recipe.ingredients
6+
*/
37
// This program should log out the title, how many it serves and the ingredients.
48
// Each ingredient should be logged on a new line
59
// How can you fix it?
@@ -12,4 +16,4 @@ const recipe = {
1216

1317
console.log(`${recipe.title} serves ${recipe.serves}
1418
ingredients:
15-
${recipe}`);
19+
${recipe.ingredients.join("\n")}`); // this make the list to be logged on a new line - not predicted at first

0 commit comments

Comments
 (0)