// Setup
function phoneticLookup(val) {
var result = "";
// Only change code below this line
var lookup ={
"alpha":"Adams",
"bravo" :"Boston",
"charlie" :"Chicago",
"delta" :"Denver",
"echo" :"Easy",
"foxtrot": "Frank"
};
var val= "delta";
result=lookup.val;
// Only change code above this line
return result;
}
// Change this value to test
phoneticLookup("charlie");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.
This code is looking for the “val” key inside the lookup object. What you want is what is inside the val variable, the only way to access an object key using a variable is using bracket notation, like so: