Skip to content

Instantly share code, notes, and snippets.

@teisman
Created February 26, 2016 12:40
Show Gist options
  • Save teisman/a2c6f07880db1d2301f6 to your computer and use it in GitHub Desktop.
Save teisman/a2c6f07880db1d2301f6 to your computer and use it in GitHub Desktop.
var Recipe = function (title, servings, ingredients) {
this.title = title;
this.servings = servings;
this.ingredients = ingredients;
};
Recipe.prototype.print = function() {
console.log(this.title);
console.log("Serves: " + this.servings);
console.log("Ingredients:")
for (i = 0; i < this.ingredients.length; i++) {
console.log(this.ingredients[i]);
}
};
var mole = new Recipe("Mole", 2, ["cinnamon", "cumin", "cocoa"]);
mole.print();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment