Hi Guys. I’m stuck on it, because in the example there is not other variable being used, so or I don’t get the english in the question or the question it’s not making itself clear.
I’m supposed to do something like this…
// Only change code below this line
var gloveBoxContents = “”; { myStorage.car.inside[“glove box”]; } // Change this line
I don’t understand why this is the solution. Looking at the lesson it seems to be that this should be the correct code:
myStorage.car.inside["glove box"]; // Change this line
When I run the tests though, I can not pass. However, when I run this on repl.it, the output is “maps.” Then, if I switch the code to the solution above on repl.it, I receive an “undefined” message there.
The lesson seems to teach that my code is what the lesson is about. However, it doesn’t work on FCC. What is going on? Is it an FCC bug?
Worked for me. Just had an “AH-HA” moment as I figured out the answer.
Basically each { denotes a folder. So you have to type out each folder path as if you were telling a search on the computer to find a certain file. So “car” is a folder containing “inside” folder which contains “glove box” file.
Hope that makes sense to you, makes sense to me. lol
Here, how can we access Big Burgers?
I tried using two square brackets for “McDonalds Outlet” and “Big Burger”, but it doesn’t work.
For the dot operator, it needs a quantity without a space in between.
So solution please.
I am just a beginner at present.
var gloveBoxContents = myStorage.City[“Central Square”][“McDonalds Outlet”]; // Change this line
Hello!! I’m fairly new to this too, so forgive me if I mess anything up!
You wouldn’t need to place “Big Burgers” in any kind of notation since it’s going to be the output. You just need to get as far as the surrounding “folder” so you can then pull out the contents.
You want to look in “City Folder”, then “Central Square” Folder, then “McDonalds Outlet” Folder to pull out and view Big Burgers giving you:
var gloveBoxContents = myStorage.City[“Central Square”][“McDonalds Outlet”];
If it isn’t showing you the correct result, try reseting the code and refreshing your page and then retype the code. I know I have to do that ALL the time.
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.
SPOILER ALERT
Solution 1:
Initialize variable gloveBoxContent
Get the value of “glove box” under myStorage variable and assign that to gloveBoxContents
// Only change code below this line
var gloveBoxContents = myStorage.car.inside["glove box"]; // Change this line
Thank you for taking the time to make an entry that is well-formatted and designed to help campers. I have merged your post with the official guide thread and added a spoiler blur to your solution.