Using Objects for Lookups help please

Tell us what’s happening:
I can’t figure out what the instructions are asking for. Please help

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.alpha;



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

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









Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups

in last line
result=lookup.alpha;
here you did the mistake you need to pass value here

lookup[val]

like this

Or you can just use the bracket notation like this lookup[val]

1 Like