Skip to content

Instantly share code, notes, and snippets.

@saposki saposki/plant.js
Created Dec 4, 2015

Embed
What would you like to do?
// plant.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
You can’t perform that action at this time.