You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
Did you know you can also have an array of objects? We've created one for you here. Loop through the array,
and for each object, `console.log()` out the sentence:
"Hi, my name is {firstName} {lastName}. I am {age} years old, and work as a {occupation}."
Here is the array:
*/
let writers = [
{
firstName: "Virginia",
lastName: "Woolf",
occupation: "writer",
age: 59,
alive: false
},
{
firstName: "Zadie",
lastName: "Smith",
occupation: "writer",
age: 41,
alive: true
},
{
firstName: "Jane",
lastName: "Austen",
occupation: "writer",
age: 41,
alive: false
},
{
firstName: "bell",
lastName: "hooks",
occupation: "writer",
age: 64,
alive: true
}
];
for(let key in writers){
if(writers[key].alive === true ){
console.log(`Hi, my name is ${writers[key].firstName} ${writers[key].lastName}. I am ${writers[key].age} years old, and work as a ${writers[key].occupation}`);
}
}
/*
If you want an extra challenge, only `console.log()` the writers that are alive.