I cant get the "Basic Javascript: Using Objects for Lookups" to pass

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

  // Only change code below this line
function phoneticLookup(val) {
  var result = "";
  var lookup = {
    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank"
  };
}
  // Only change code above this line
  return result;
}

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

I am getting a result saying that nothing is equal to each other and that phonetic lookup " " is undefined. I’m not sure why because I thought I equalized each one with the : symbol

Hi

// 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[val];

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

// Change this value to test
phoneticLookup("charlie");
1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums