Basic JavaScript - Using Objects for Lookups

i am so proud of myself doin it the right way before watching the video BUT everytime i must do smt wrong , can i get an explain ? :c

  **Your code so far**
// Setup
function phoneticLookup(val) {
let result = "";

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

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

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Using Objects for Lookups

Link to the challenge:

Here you are replacing the function argument val with this object.

Which makes this line baffling for your computer. Look inside of the object val to find the value associated with the key val, but val is an object and cannot be a key…

1 Like

It worked , good to know
Thank you Jeremy for helping me get this things easly !
I feel kinda bad cuz i keep posting so many topics :disappointed_relieved:

The forum is here for people to ask questions!

1 Like