Basic JavaScript - Using Objects for Lookups

Tell us what’s happening:
Describe your issue in detail here.
i am stuck on using objects for Lookup

  **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("chicago");
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Using Objects for Lookups

Link to the challenge:

Hi

When I run the tests with your code, I see this in the console:

phoneticLookup("foxtrot") should equal the string Frank

Does your code return Frank ?
Remember - capitalisation is important.

1 Like

Hello @sofipay7869 !
I guess the problem in your code is the capitalisation. You wrote “frank instead of “Frank”.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.