** Need Help ** Javascript: Using Objects for Lookups

Here’s the link to the challenge:

Here’s 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;

When I point to “lookup”, it says “is declared but the value is never read”.

I’m not sure what I’m doing wrong here. Please advise.

Thanks in advance!

I think you should use lookup constant to search for the value of val,
but you are simply returning result which is “”

search for value in object using key

You are almost there. Now you have to use val to read lookup and put it’s value to result.

1 Like

How would you access the value of alpha from the lookup object? For example loopup['alpha']. The function is meant to use its parameter “val” as the property name of the object to access. If we know val is equal “alpha”, we can say instead lookup[val]. That is pretty much the result you want to return

1 Like

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