Tell us what’s happening:
Hi guys! For result = lookup[val]; at the end, is there a reason why only bracket notation works and not dot notation?
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",
}
result = lookup[val];
// Only change code above this line
return result;
}
console.log(phoneticLookup("charlie"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Using Objects for Lookups
Link to the challenge: