Challenge Accessing Objects Properties with Bracket Notation has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// Setup
var testObj = {
"an entree": "hamburger",
"my side": "veggies",
"the drink": "water"
};
// Only change code below this line
var entreeValue = testObj["an entree"]; // Change this line
var drinkValue = testObj["the drink"]; // Change this line
EXAMPLE:
var myObj = {
"Space Name": "Kirk",
"More Space": "Spock"
};
myObj["Space Name"]; // Kirk
myObj['More Space']; // Spock
ISSUE:
the example doesn't match the exercise causing confusion.
@ar94952 thanks for the issue. Can you elaborate on how the example doesn't match the exercise and causing confusion? I think the example shows that you can use the property names (e.g. Space Name) to access its value (e.g. Kirk) as shown in the example as myObj["Space Name"] and its value is Kirk.
Using the same logic, you should be able to find the corresponding value of, say, the property an entree using the same bracket notation.
In general, if you get stuck or have questions with a challenge in the future, please first ask questions to the Help Room. But please let us know how it is confusing. We strive to make the challenges as clear as possible.
the following was not included in the example:
var someValue =
var somValue =
including only the other side of the equation had me confused for a few seconds.
@ar94952 thanks for the clarification. This seems to be more of a coding question, so instead of asking for help here, please click the "help" button on the challenge on freeCodeCamp, which will take you to the help chatroom for that specific challenge. You can also view our full list of official chatrooms. Thank you, and happy coding!
Thanks for your help. // Setup
var testObj = {
"an entree": "hamburger",
"my side": "veggies",
"the drink": "water"
};
// Only change code below this line
var entreeValue = testObj ["an entree"]; // Change this line
var drinkValue = testObj ["the drink"]; // Change this line