Tell us what’s happening:
Describe your issue in detail here.
Your code so far
// Setup
function phoneticLookup(val) {
let result = "";
// Only change code below this line
let lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};
result = lookup[value];
// Only change code above this line
return result;
}
phoneticLookup("charlie");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
Challenge: Basic JavaScript - Using Objects for Lookups
please I don’t really know what is wrong with code and am getting confused.
please can anyone help me out figure out my error(s) out?
function phoneticLookup(val) {
let result = "";
// Only change code below this line
let lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};
result = lookup[value];
// Only change code above this line
return result;
}
phoneticLookup("charlie");
No, I meant, where is the variable called value defined? You cannot use variables without defining them somewhere (either in code, using let or const, or by using them in the arguments of the function)