Help with Basic JavaScript: Using Objects for Lookups

here is the link to the (challenge).

I think I understand , here is my code:

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

  // Only change code below this line
  var lookup = {
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
 var value = 3

  // Only change code above this line
  return result;


just not sure of the last part, and dont want to look at answer yet.

The challengs states that: You should not use case , switch , or if statements. Your code is sorta full of them.

for the challenge to pass the function needs to return the right value
the return statement of the function says return result
the result variable has been initialized with the linevar result = ""; and never changed

try making sure that your function returns the right value

oh ok thanks, I will correct this :+1:

where the hell do you see them?

@lukeMersh don’t worry about that comment, you did not do anything wrong in that regard. you have really just not changed the variable that is returned.

I am doing a little bit of research on the new to further understand how the logic works.

if you need someone else to take a look at your code again just post your updated code in this thread! Happy research :slight_smile:

1 Like

ok , som i cheated on this one as the answer appears to still use cases ( i think)

var lookup = {
    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank"
result = lookup[val];

I was under the understanding the "foxtrot": "Frank" is a case statement.
can somebody please explain to me
thx in advance

that is a key-value pair in an object
cases are a switch thing and exist only inside a switch statement and use the case keyword

@KittyKora comment was totally out of place