Using objects for lookups

// Setup
function phoneticLookup(val) {
var result = “”;

// Only change code below this line
val ={
“alpha”:“Adam”,
“bravo”:“Boston”,
“charlie”:“Chicago”,
“delta”:“Denver”,
“echo”:“Easy”,
“foxtrot”:“Frank”
};

// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup(“charlie”);

How can the string be assigned to result?

Check out this and this.

1 Like

i know this but i don’t know how to turn it into lookup, i mean i could do result = myobj.alpha;
result=myObj.bravo;
then etc.
but only the last one is correct - so how do i assign the whole string to result?

how can it all be assigned to result though?

yeah but what exactly? pls can you give me the answer ten ill ask if i have any questions?

what do i assign the result to?
pls type out the hole code

whoops! I understood it now! I manipulated what you said and it worked! Thank you :smiley: