Why doesn't my code work? Using Objects for Lookups

Hello everyone,

I am doing Using Objects for Lookups module on JavaScript Algorithms and Data Structures and I’ve ran into a problem here. I feel like I am on the right track, but I am still stuck. Here is my code:

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

  // Only change code below this line
  const lookup = {
    alpha: "adams",
    bravo: "boston",
    charlie: "Chicago"
    delta: "Denver"
    echo: "Easy"
    foxtrot: "Frank"
  }

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

phoneticLookup("charlie");

Please provide the challenge link so we can see the lesson you are working on

you have to pass the value of lookup.val to result before returning it

How did you know that? Where does it say that syntax is needed? ):

Link: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups

Convert the switch statement into an object called lookup. Use it to look up val and assign the associated string to the result variable.

typed exactly what you said but nothing happened.

right now you first declare result to be an empty string. then you didn’t update the value, you returned result without modifing it
so result will still be = “”

but it said not to update code above that line

You don’t need to update the initialization to update the value stored in the variable.

not actually llokup.val … I only mean you have to pass the value of the obj.key to result
before returning result

wish I could get verbal explanation because I don’t understand. Learning disability, sorry ):

hehehe It’s ok I feel this way a lot
besides It’s probably my fault my english is not that good

You are close. You need to try to update the value of result based upon the contents of lookup. Give it a try.

But it says I cannot update result

Is what I typed correct at all?

No. It does not say you cannot update result. Its says you cannot change anything about the comment. But you can update the contents of the variable result below that comment.

Yes, as I said above:

Well what do I have to change the result to? That’s what I don’t understand at all. I have everything filled in already with the required strings

const lookup = {
    alpha: 'Adams',
    bravo: "boston",
    charlie: "Chicago",
    delta: "Denver",
    echo: "Easy",
    foxtrot: "Frank",

You created the lookup object, but you are not doing anything with it at all. Lets add some comments to you code:

function phoneticLookup(val) {
  // Create a variable for our result
  let result = "";

  // Create a lookup object
  const lookup = {
    alpha: "adams",
    bravo: "boston",
    charlie: "Chicago"
    delta: "Denver"
    echo: "Easy"
    foxtrot: "Frank"
  }

  // Do nothing with the lookup object and return the empty string
  return result;
}
function phoneticLookup(val) {
  let result = "";

  // Only change code below this line
  const lookup = {
    alpha: result,
    bravo: result,
    charlie: result,
    delta: result,
    echo: result,
    foxtrot: result,
  }


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

phoneticLookup("charlie");```