Stuck in the challenge "Using Objects for Lookups "

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

Hi, I am stuck at the challenge. I cannot modify the return statement, not even by creating a variable “result”, and set the value as lookup[val]. The code doesn’t work if the result statement unchanged, also the hint of the challenge suggests that modification is necessary.
Can someone help me with this?

Can you post the code you’ve currently got that isn’t working?

certainly, it is as follows:

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

// Only change code above this line
return result
}

// Change this value to test
phoneticLookup(“charlie”);

The result var is already declared for you on line 3, you just need to reassign it.

I have tried that, but still not working. seems like any kind of modification is not allowed

2 Likes

There is a semicolon missing at the end of the return statement

yeah, I noticed that as well. It still doesn’t work after adding one though. Assigning value to result at line 3 also doesnt work

Try copying the part of your code between the two “only change code above/below this line” lines, and reset the code

It may be that you changed something without meaning to. the tests are really specific in this case

That’s done it! Thanks

thanks man i couldn’t figure out how to assign the properties at the final part.