Tell us what’s happening:
Hi people, I just want to ask one thing, is it necessary to leave the variable result after the creation of the object? I mean the code works just fine callin the function so I don’t see why I don’t have to change the code below and above the line, am I missing something?
// Setup
function phoneticLookup(val) {
let result = ""; // <-this variable here
// Only change code below this line
var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo": "Easy",
"foxtrot":"Frank"
};
return lookup[val];
// Only change code above this line
return result;
}
var test = phoneticLookup("charlie");
console.log(test);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36
Challenge: Using Objects for Lookups
Link to the challenge: