Tell us what’s happening:
Hey everybody! Can you spot the mistake?
Your code so far
// 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"
};
const lookup = result;
// Only change code above this line
return result;
}
phoneticLookup("charlie");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15
Challenge: Basic JavaScript - Using Objects for Lookups
Link to the challenge:
Good question
I thought it could be used to output result.
That line says, “declare a brand new variable called lookup
and put the current value stored in the variable called result
into this new variable called lookup
”
hmm… then that’s not the output I am looking for.
Can you give me a hint of change?
const articleAuthor = article["author"];
const articleLink = article["link"];
const value = "title";
const valueLookup = article[value];
This was the example in the Challenge, so you probably need something that looks like that?
You want to update the result
with the values given in the lookup
and the val
.
system
Closed
March 2, 2024, 3:58am
7
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.