Basic JavaScript - Using Objects for Lookups

I have been stucc in this code and I need help

Your code so far

// Setup
function phoneticLookup(val) {
  let result = "";

  // Only change code below this line
  var lookup = {
    ‘alpha’: “Adams”,
    ‘bravo’: “Boston”,
    charlie: “Chicago”,
    delta: “Denver”,
    echo: “Easy”,
    foxtrot: “Frank”
  };
    
  
  // Only change code above this line
  return result;
}

phoneticLookup("charlie");

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 13; 23028RNCAG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Mobile Safari/537.36

Challenge: Basic JavaScript - Using Objects for Lookups

Link to the challenge:

  • double quotation is here used not quite “parsed” as double quotes, so try simply using “double quotes” from keyboard
  • for keys you dont need to use “quotation” around them, but for “json” you have to
  • your “result” variable is not getting updated!! checkout given example how they are using “keys” to get value out of an “object”, try that in here

happy learning :slight_smile:

1 Like

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