This there code below
// Setup
var testObj = {
“an entree”: “hamburger”,
“my side”: “veggies”,
“the drink”: “water”
};
// Only change code below this line
var entreeValue = testObj; // Change this line
var drinkValue = testObj; // Change this line
This what they want me to do:
1)entreeValue should be a string
2)The value of entreeValue should be "hamburger"
drinkValue should be a string
3)The value of drinkValue should be "water"
4)You should use bracket notation twice
This is how i answered it but its wrong.
This my code code
// Setup
var testObj = {
“an entree”: “hamburger”,
“my side”: “veggies”,
“the drink”: “water”
};
// Only change code below this line
var entreeValue = testObj[“humnurger”]; // Change this line
var drinkValue = testObj [‘Water’]; // Change this line
The problem wants you to retrieve the values 'hamburger' and 'water' from the testObj object and assign them to the variables entreeValue and drinkValue, respectively.
Note that testObj has three keys: 'an entree', 'my side', and 'the drink'. Now which of these should you use to retrieve 'hamburger' and 'water'? Pick those two keys that go in between the brackets.
`// 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"]; `