Skip to content

Commit 9256b7f

Browse files
committed
debug the code
1 parent d4df6a4 commit 9256b7f

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎Sprint-2/debug/author.js‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
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
55

6-
const author = {
7-
firstName: "Zadie",
8-
lastName: "Smith",
9-
occupation: "writer",
10-
age: 40,
11-
alive: true,
12-
};
6+
// I think the issue with the original code is it was trying to loop over the object directly,
7+
// which is not iterable. Instead, we should loop over the array that contains the object.
8+
9+
const author = [
10+
{
11+
firstName: "Zadie",
12+
lastName: "Smith",
13+
occupation: "writer",
14+
age: 40,
15+
alive: true,
16+
},
17+
];
1318

1419
for (const value of author) {
1520
console.log(value);

0 commit comments

Comments
 (0)