Basic JavaScript - Using Objects for Lookups

Tell us what’s happening:

I converted the switch statement into an object called lookup, but I got it all wrong. I’d like to know where the error is.

Your code so far

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

  // Only change code below this line
  const 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36

Challenge Information:

Basic JavaScript - Using Objects for Lookups

Never mind. I figured it out.

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