-
-
Notifications
You must be signed in to change notification settings - Fork 278
Expand file tree
/
Copy pathauthor.js
More file actions
24 lines (21 loc) · 609 Bytes
/
author.js
File metadata and controls
24 lines (21 loc) · 609 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Predict and explain first...
//it will have an errors
// 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
//The problem is that the variable author is an object which is not iterable in for.. of loops. You have to use either values, keys or entries.
const author = {
firstName: "Zadie",
lastName: "Smith",
occupation: "writer",
age: 40,
alive: true,
};
for (const value of Object.values(author)) {
console.log(value);
//Prints the following output:
//Zadie
//Smith
//writer
//40
//true
}