FAQ: Objects - Looping Through Objects

That’s because it refers to the member’s role on the spaceship. It is not a programming term, though it is an attribute in HTML.

So it’s more of a common sense thing than anything that went over my head? That makes sense, easy to get lost with a microfocus on this stuff. Thank you for the quick reply!

1 Like

Without seeing the code we could assume that role is a property of each crew member object. In that case iterating over the crew object we could poll that property on each member.

Please post a link to the exercise so we can verify or refute this assumption.

Belay, belay. The link at the top of this page works.

Okay, what the author is calling a role is not given as a property. Their role IS the property.

'chief office'

Those are all keys of the crew object.

So, ‘role’ in this case refers to the position/duty they serve on the ship.

I think that is what was confusing me, the fact that it isn’t given as its own property. The fact that the other exercises, such as step 2…

Using for...in , iterate through the spaceship.crew object in the code editor and console.log() a list of crew names and degrees in the following format: '[crew member's name]: [crew member's degree]' , i.e., 'Lily: Computer Engineering' .

…uses a property (degree) that is explicitly stated made step 1’s usage of “role” confusing to me as I found nothing in the code itself that directly mentioned that. But I got it now… at least I think I do!

1 Like