Basic JavaScript - Using Objects for Lookups

Tell us what’s happening:

i have redone this step more than once now, I have looked at the help guide, I even looked at the example given. Everything seems to be lining up correctly, but I can’t see the issue.

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;


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

Basic JavaScript - Using Objects for Lookups

1 Like

Hello. That is a very nice lookup object. But in the code, you’ve posted, you’ve not actually assigned result to a value.

Hope this helps. Happy learning. :slightly_smiling_face:

1 Like

When I do set up the result to:

var result = “”

it doesn’t pass, did i not do it correctly?

it also says the result has already been declared

result should be assigned the value from the lookup.

someVar = lookup[prop]

As an example:

function getFullName(firstName) {
  let fullName = "";

  const fullNameLookup = {
    John: "John Doe",
    Jane: "Jane Doe",

  fullName = fullNameLookup[firstName];
  return fullName;

console.log(getFullName("John")); // John Doe
console.log(getFullName("Jane")); // Jane Doe