Tell us what’s happening:
I have been looking at the answers, and still can’t understand why this object lookup code doesn’t work.
I thought that Modern JS practice would be to declare the lookup variable using const instead of var, but notice that this exercise still uses var.
Your code so far
// 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;
}
phoneticLookup("charlie");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15
.
Challenge: Using Objects for Lookups
Link to the challenge: