* fix: restructure certifications guide articles * fix: added 3 dashes line before prob expl * fix: added 3 dashes line before hints * fix: added 3 dashes line before solutions
779 B
779 B
title
title |
---|
Using Objects for Lookups |
Using Objects for Lookups
Solutions
Solution 1 (Click to Show/Hide)
function phoneticLookup(val) {
var result = "";
var lookup = {
"alpha": "Adams",
"bravo": "Boston",
"charlie": "Chicago",
"delta": "Denver",
"echo": "Easy",
"foxtrot": "Frank"
};
// After converting our case statements into object properties you can make use of the variable `result` to let the function return the correct value.
result = lookup[val];
// Only change code above this line
return result;
}