Using Objects for Lookups
function phoneticLookup(val) {
var result = "";
var lookup = {
"alpha":"Adams",
"bravo":"Boston",
"charlie":"Chicago",
"delta":"Denver",
"echo":"Easy",
"foxtrot":"Frank",
};
result = lookup[val];
return result;
}
phoneticLookup("charlie");
console.log(phoneticLookup("alpha")); // to test
console.log(phoneticLookup("")); //to test