Basic JavaScript - Using Objects for Lookups

My code doesn’t pass. I don’t know why. .

  **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
result = lookup[val];
return result;
}

phoneticLookup("charlie");
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15

Challenge: Basic JavaScript - Using Objects for Lookups

Link to the challenge:

What is lookup in your code?

I defined it as a var in line 3?

Hey there, I tried your code on my end and it passes for me. I think I read that you’re coding in Safari on a Mac? Make sure you’re using Chrome if you can. Many of the Free Code Camp pages can’t load/code in their provided coder correctly if you don’t use a broweser/OS that works a little better with their webpages. I’m not entirely sure why it’s this way, but I’ve been using Chrome exclusively and it loads, works correctly almost all of the time, and I’ve had very few issues I can’t solve with a retype or a reload.

It’s clear you understand your code and what you’re talking about… Just see if the bigger problem is the webpage source/operating system you’re using to get it done with!

Best of luck, keep coding! (Your code answer was the same as mine!)

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