forked from CodeYourFuture/Module-Data-Groups
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthor.js
More file actions
22 lines (17 loc) · 630 Bytes
/
Copy pathauthor.js
File metadata and controls
22 lines (17 loc) · 630 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Predict and explain first...
// I thought the value in the log needed to get attached with the author like value.author
// But the error was author is not iterable as it is an object, so we need to modify the for ... of loop as
// for(const value of Object.values(author))
// This program attempts to log out all the property values in the object.
// But it isn't working. Explain why first and then fix the problem
const author = {
firstName: "Zadie",
lastName: "Smith",
occupation: "writer",
age: 40,
alive: true,
};
for (const value of Object.values(author)) {
console.log(value);
}
// Author.js corrected.