Hi
why does the return with the empty quotes affect the whole code if taken off?
Why does the code not work if I take away the quotes from a property? Because I took it a few lesson back that without quotes would still work?
And why does it not run without the return? Is there an alternative to return?
I got okay but couldnt write the code for the value to be associated with the function. I want to understand it better before moving on.
Thanks
// 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",
}
// Only change code above this line
return result = lookup[val]
}
console.log(phoneticLookup("charlie"));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.68
.
Challenge: Using Objects for Lookups
Link to the challenge: