Basic JavaScript: Using Objects for Lookups, Pls Help

Basic JavaScript: Using Objects for Lookups, Pls Help
0

Tell us what’s happening:
I got this error message:

phoneticLookup("") should equal undefined

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;
}

phoneticLookup("charlie");

Your browser information:

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

Challenge: Using Objects for Lookups

Link to the challenge:

Hello there.

Do you have a question? If so, please edit your post to fill in the Tell us what’s happening section.

We cannot help, if you do not ask a question.

1 Like

Oops!!! Sorry, my bad. Post edited!!!

Well, pay attention to what is happening on this line:

result += lookup[val];

Hint: It is a very simple fix;

1 Like