This code is my first attempt to create a module which gives the full name when given the nick name. but I am getting undefined in the results and don't know why. Thanks
let nameProper = (function nameProper (nameShort) {
let names = {
"fj": "Fred Johnson"
};
return function () {
return names['nameShort'] || nameShort;
};
}());
let myName = nameProper('fj');
names['nameShort'] || nameShort;why are you stringifyingnameShort? you probably wantnames[nameShort] || nameShort;