I get the error: “phoneticLookup(”") should equal undefined"
How can I add this “functionality” to react with undefind on empy val?
golfo
// 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";
}
result = lookup[val];
// Only change code above this line
return result;
}
// Change this value to test
phoneticLookup("charlie");
Properties in objects are separated by commas(,
), not semicolons (;
).
Thanks.
Changed that but ended up with the same result
results:
phoneticLookup(“alpha”) should equal "Adams"
phoneticLookup(“bravo”) should equal "Boston"
phoneticLookup(“charlie”) should equal "Chicago"
phoneticLookup(“delta”) should equal "Denver"
phoneticLookup(“echo”) should equal “Easy"
phoneticLookup(“foxtrot”) should equal “Frank"
phoneticLookup(””) should equal undefined
You should not use case, switch, or if statements
all ok until the last two
I got it
I forgot = between lookup and {
and ; at the end of the object
working now with: (but interesting, that it worked with semicolon nearly to the end)
// 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"
};
result = lookup[val];
// Only change code above this line
return result;
}
// Change this value to test
phoneticLookup("charlie");