Joined January 2016
·

Antoine Polatouche

France
·
·

Hi there,

1) Why are you using functions in the looking table.
Why not

var lookupTable = {

"pizza": "food",

"house": "building",

"air": "nothing",

};

console.log(lookupTable[condition]);

???

2) No default value in your examples.
In real life you'll have one generally. In this case, the lookup table is less efficient because you have to test the return value.

Achievements
1 Karma
0 Total ProTip Views