Using Objects for Lookup

Tell us what’s happening:

Your code so far

// Setup
function phoneticLookup(val) {
  var result = "";
  var lookup="";
  // Only change code below this line
  val= {
     "alpha": 
       "Adams",
      
    "bravo": 
      "Boston",
      
    "charlie": 
      "Chicago",
      
    "delta": 
      "Denver",
      
     "echo": 
      "Easy",
      
    "foxtrot": 
      "Frank",
    "":""
  };

  // Only change code above this line
  result=lookup[val];
  return result;
}

// Change this value to test
phoneticLookup("charlie");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/using-objects-for-lookups

Hi! I think you misplaced the object to the argument val. It should be on the variable lookup.

var lookup = {
    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank"
  };
2 Likes