Skip to content

Instantly share code, notes, and snippets.

@syzer
Created November 3, 2014 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syzer/7eb549117f3291d9ff53 to your computer and use it in GitHub Desktop.
Save syzer/7eb549117f3291d9ff53 to your computer and use it in GitHub Desktop.
MakesSanwich
function makeSandwich() {
var preparedFood = 'Here is a sandwich with: ';
return {
addLattice: function () {
// Lattice logic here
preparedFood += 'Lattice';
return this;
},
addBacon: function () {
preparedFood += 'Bacon';
return this;
},
addTomato: function () {
preparedFood += 'Tomato';
return this;
},
getFood: function () {
return preparedFood;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment