Last active
February 9, 2019 08:25
-
-
Save afrieirham/a7c4bfae1c115b557e5c3d0edf9d97c6 to your computer and use it in GitHub Desktop.
Basic JavaScript: Using Objects for Lookups #FCC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup | |
function phoneticLookup(val) { | |
var result = ""; | |
let lookup = { | |
alpha: 'Adams', | |
bravo: 'Boston', | |
charlie: 'Chicago', | |
delta: 'Denver', | |
echo: 'Easy', | |
foxtrot: 'Frank', | |
} | |
result = lookup[val]; | |
return result; | |
} | |
// Change this value to test | |
phoneticLookup("alpha"); | |
phoneticLookup("bravo"); | |
phoneticLookup("charlie"); | |
phoneticLookup("delta"); | |
phoneticLookup("echo"); | |
phoneticLookup("foxtrot"); | |
phoneticLookup(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment