Skip to content

Commit 5a797a0

Browse files
authored
Fix iteration method for author object
Replaced for-of loop with for-in loop to iterate over object properties.
1 parent 4222cda commit 5a797a0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎Sprint-2/debug/author.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ const author = {
1111
alive: true,
1212
};
1313

14-
for (const value of author) {
15-
console.log(value);
14+
// for (const value of author) {
15+
// console.log(value);
16+
// }
17+
18+
for (const key in author) {
19+
console.log(author[key]);
1620
}
21+
22+
// the iteration method does not work for the object.
23+
// TypeError TypeError: author is not iterable will be shown
24+
// Change the correct method with the object

0 commit comments

Comments
 (0)