Looping through objects

Hi, i´m stuck on this since yesterday, can you please help me understanding what am i doing wrong?
It keeps puting an error " Did you console.log( ) in correct format? Tks!
"

crewMember is an object in its own right so we can forego the parent object.

crewMember.name
crewMember.degree

Thank you so much for your help, but i still don´t understand because in the “hint” for the 1 question the layout have the two objects, and i still can´t see what i´m doing wrong :weary:

Consider,

for (let x in spaceship.crew) {
    console.log(`${x.name}, ${x.degree}`)
}

Output undifined, i´m going crazy with this step…

Rather than a picture, please post your raw code in a reply.

1 Like

Right, sorry, i wrote like this :

for (let crewMember in spaceship.crew) {
console.log(${crewMember.name},${crewMember.degree});
};

Have you figured why it is undefined? That what we mean by, ‘consider’.

x is a variable, so it must be subscripted.

let crew = spaceship.crew
for x in crew
    log crew[x].name
1 Like