Tell us what’s happening:
Hey guys, actually I am having trouble understanding why are we using val here in
lookup[val] as val does not exist in lookup as property.
Your code so far
// 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"
};
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/86.0.4240.75 Safari/537.36.
Thanks for taking the time to explain it in such an elaborative way, I understand now that it is just acting a placeholder for the value that we are passing to phoneticLookup