function makeSandwich (topping) { return function (filling) { return topping + ' and ' + filling } } const chickenBacon = makeSandwich('Chicken') const beefEgg = makeSandwich('Beef') chickenBacon('Bacon') // => 'Chicken and Bacon' beefEgg('Egg') // => 'Beef and Egg'
function makeSandwich (topping) { return function (filling) { return topping + ' and ' + filling } } const chickenBacon = makeSandwich('Chicken') const beefEgg = makeSandwich('Beef') chickenBacon('Bacon') // => 'Chicken and Bacon' beefEgg('Egg') // => 'Beef and Egg'