Tell us what’s happening:
Your code so far
// Setup
function phoneticLookup(val) {
var result = "";
// Only change code below this line
var phoneticLookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
'delta': "Denver",
"echo": "Easy",
"foxtrot": "Frank",
}
result=phoneticLookup[val];
// Only change code above this line
return result;
}
phoneticLookup("charlie");
Hi,
Was hoping to get an answer to a fairly simple question for someone with more experience:
I have tried a couple console.log statements to get the result to appear on my console… I keep getting errors. The reason is that without a lot of experience and grasp, I am obviously missing something.
if I try this:
result=phoneticLookup[val];
console.log(phoneticLookup(“charlie”));
Why will it not turn up “Chicago” in my console?
Thanks!
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:77.0) Gecko/20100101 Firefox/77.0
.
Challenge: Using Objects for Lookups
Link to the challenge: