Learn Modern JavaScript Methods By Building Football Team Cards - Step 20

Tell us what’s happening:

I’ve been stuck on this problem for hours. It’s asking to use the deconstruction syntax to access the ‘coachName’ value which is already nested inside of the ‘headCoach’ object. I don’t think the course has gone over on how to access a value inside of an object. The code I provided is from research I did on google and it still doesn’t work, what am I missing? I appreciate the help.

Your code so far

const { headCoach: { coachName } } = myFavoriteFootballTeam;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Modern JavaScript Methods By Building Football Team Cards - Step 20

Hey @JVFET and welcome to the FCC community!

When destructuring, the syntax is like this:

const { propertyName } = someObjectContainingThisProperty;

If I have an object like this:

const aRandomObject = {  
    personName: 'Bob Bobbertson'
};

I can use the destructuring syntax to access it.

const { personName } = aRandomObject;
console.log(`Hello, ${personName}, it is nice to meet you!`);

What that did was pull the property out of the object and into its own variable.

All you need to do is use that same syntax to pull the property coachName out of the object myFavoriteFootballTeam.headCoach.

Thank you Marcus that helped.

const { myFavoriteFootballTeam, headCoach} = coachName;

what am i doing wrong?

const car = {
type: “sport”,
spec: {
yearBuilt: 2012,
manufacturer: “BMW”,
}
};

const { manufacturer } = car.spec;

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.