Skip to content

Instantly share code, notes, and snippets.

@CH34MKE10
Created December 11, 2014 05:55
Show Gist options
  • Save CH34MKE10/4c3487ffa0dd715cd406 to your computer and use it in GitHub Desktop.
Save CH34MKE10/4c3487ffa0dd715cd406 to your computer and use it in GitHub Desktop.
Sandwich JS
function Sandwich(bread, veggies, meat, dressing) {
this._bread = bread;
this._veggies = veggies;
this._meat = meat;
this._dressing = dressing;
}
Sandwich.prototype.getOrder = function ( ) {
var order = {
bread: this._bread,
veggies: this._veggies,
meat: this._meat,
dressing: this._dressing
}
return order;
}
var myVeggies = ["lettuce","spinach","tomato"];
var mySandwich = new Sandwich("wheat", myVeggies, "turkey", "mustard");
var myOrder = mySandwich.getOrder();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment