Created
June 6, 2017 09:44
-
-
Save victoriadrake/78f8a9d618df45d35e44202562f1c361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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