Using objects for lookups

Using objects for lookups
0

#1

// 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?


#2

Check out this and this.


#3

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?


#5

how can it all be assigned to result though?


#7

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


#8

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


#9

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