[Basic JavaScript: Using Objects for Lookups] solution checker marks everything as incorrect no matter what I do, even after looking up the answer

Tell us what’s happening:
I set each item to their proper value, yet the solution checker marks everything as incorrect. I can’t figure out what I’m doing wrong

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",
  "echho": "Easy",
  "foxtrot": "Frank"
}

// Only change code above this line
return result;
}

phoneticLookup("charlie");

Your browser information:

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

Challenge: Using Objects for Lookups

Link to the challenge:

Your code is not correct.
result is initialized to an empty string and is never reassigned. That means that your code will always return an empty string.

2 Likes

You’ve also got a typo here:

1 Like