1function getDrink (type) {
2 var drinks = {
3 'coke': 'Coke',
4 'pepsi': 'Pepsi',
5 'lemonade': 'Lemonade',
6 'default': 'Default item'
7 };
8 return 'The drink I chose was ' + (drinks[type] || drinks['default']);
9}
10
11var drink = getDrink('coke');
12// The drink I chose was Coke
13console.log(drink);
14
1{(() => {
2 switch (header) {
3 case "Name": return entry.name;
4 case "Type": return entry.type;
5 default: return entry.name;
6 }
7})()}