Challenge Accessing Nested Objects in JSON has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};
// Only change code below this line
var myStorage = myStorage.car.inside["glove box"];// Change this line
Is this a bug please? , sticking the code into chrome and testing myStorage; returns "maps" , so seems to push the correct data into myStorage , please help as my brain hurts..
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};
// Only change code below this line
var myStorage = myStorage.car.inside["glove box"];
undefined
myStorage;
"maps"
If you read the error, you would see what is happening:
ReferenceError: gloveBoxContents is not defined
For any rason you changed the variable name gloveBoxContents for myStorage. If you see myStorage is the Json, and gloveBoxContents is Where you'll save the value so chage this line:
var myStorage = myStorage.car.inside["glove box"];
To
var gloveBoxContents = myStorage.car.inside["glove box"]; // Change this line
Remember check first the gitter chat before post an issue :smile:
Got it :) , thanks ( regards the chat , only just jumped in there , very good indeed ) .
removed solution by mod
removed solution by mod
@henrihyacinthe
Please do not post your solution on here. You could help people at FreeCodeCamp Chat Room or Forum. GitHub Issues are for reporting bugs on the website only.
Happy Coding!
Most helpful comment
If you read the error, you would see what is happening:
For any rason you changed the variable name gloveBoxContents for myStorage. If you see myStorage is the Json, and gloveBoxContents is Where you'll save the value so chage this line:
var myStorage = myStorage.car.inside["glove box"];
To
var gloveBoxContents = myStorage.car.inside["glove box"]; // Change this line
Remember check first the gitter chat before post an issue :smile: