Basic JavaScript - Using Objects for Lookups

Tell us what’s happening:

Describe your issue in detail here.

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"
  };
  result = lookup(val);
  // 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/119.0.0.0 Safari/537.36 Edg/119.0.0.0

Challenge Information:

Basic JavaScript - Using Objects for Lookups

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

TypeError : lookup is not a function

Yes, lookup is not a function. It is an object, so you cannot use () and call it like a function.

Can you say more?

() calls function calls array right

You don’t really “call” an array or an object. You “access” an array or object member.