Skip to content

Instantly share code, notes, and snippets.

@saposki
Created December 4, 2015 03:49
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 saposki/149dd56ccc7298eb98c8 to your computer and use it in GitHub Desktop.
Save saposki/149dd56ccc7298eb98c8 to your computer and use it in GitHub Desktop.
// plant2.js
var Plant = function (leaves, flowers) {
this.height = 0;
this.leaves = leaves;
this.flowers = flowers;
};
Plant.prototype.grow = function () {
this.height++;
};
Plant.prototype.bloom = function () {
if(this.flowers) {
return this.flowers;
} else {
return "There are no flowers";
}
};
var rose = new Plant('pink', 'red');
console.log("rose instance", rose);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment