Skip to content

Instantly share code, notes, and snippets.

@victoriadrake
Created June 6, 2017 09:44
Show Gist options
  • Save victoriadrake/78f8a9d618df45d35e44202562f1c361 to your computer and use it in GitHub Desktop.
Save victoriadrake/78f8a9d618df45d35e44202562f1c361 to your computer and use it in GitHub Desktop.
function makeMeASandwich(x) {
var ingredients = x.join(' ');
var slices = 0;
function barry() {
return ingredients.concat(' sandwich');
}
function barryAddCheese() {
slices += 2;
return ingredients.concat(' sandwich with ', slices, ' slices of cheese');
}
return {
noCheese: function() {
return barry();
},
addCheese: function() {
return barryAddCheese();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment