https://www.freecodecamp.org/challenges/accessing-nested-objects
Ok here is what the instructions:
Instructions
Access the myStorage object and assign the contents of the glove box property to the gloveBoxContents variable. Use bracket notation for properties with a space in their name.
And i try this:
var myContent = myStorage.car[“glove box”];
var gloveBoxContents = myContent;
and this:
var gloveBoxContents = myStorage.car[“glove box”];
But in both ways the RUN TEST gives me:
gloveBoxContents is undefined
I can’t understand what i do wrong
Hi Stergies, in order for someone to help you it would help them if you explained what you have tried so far and why you think it might not have worked.
This will help them tailor their help to your needs without just telling you the answer.
Happy coding!
Thank you JacksonBates.
I will try this afternoon to put what i have done!!
Ok, I see what you’ve done, and it’s easy to fix.
Without giving it away entirely, you are trying to access the glove box from the car, but you can only access the inside or the outside from the car.
The glove box is nested inside the car object…so think about how you might need to rewrite that variable.
Spoiler / Hint
myStorage.car['glove box']
doesn’t exist!
myStorage.car.inside
and
myStorage.car.outside
do exist…as do some more nested properties…
Thank you JacksonBates …i see my mistake a few days ago,my eyes must have problem
Thank you again for your time and your help
1 Like