Assitance on using objects for lookups

Tell us what’s happening:

  **Your code so far**

// 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;
}

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

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13421.89.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36.

Challenge: Using Objects for Lookups

Link to the challenge:

I think the var result should have an “empty string” like this:

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

  // 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");

I tried the “empty strings” and it still does not work

double check your code if its similar to this!!

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

// 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 code:

result = lookup [val]… shouldn’t have “;” in the end that’s the error

//Setup

function phoneticLookup(val){

var result = “empty string”;

// 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;

}

I tried to copy the same code you sent me and it still states that it is wrong and the instruction checklist will not go through

I used the same code i sent and it passed!! you might want to double check

The console is still unresponsive

look at the code highlightning and see if you spot the missing character

It is still being unresponsive, even though I copied everything that your code sent me. I am not sure if this is a issue with the code itself or if I am doing something wrong?

what’s your code now?

hey @noxmaraba

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions

Hi thanks for that I’ll keep that in mind next time :slight_smile:

here you have wrong quotes