Basic Console.log question

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:

I’m not sure what you mean. When I add console.log(phoneticLookup("charlie"); to your code above, it works fine:

Man, that is crazy - I could not get it to work until I duplicated what you did. Then poof - worked as expected.

Thanks Ariel - appreciate the help and quick response.

My guess is that you had some small typo that was hard to see. Happens to us all. Happy coding!