Created
December 4, 2015 03:30
-
-
Save saposki/18d6e6736a55f62fce1f 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
// 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