Skip to content

Instantly share code, notes, and snippets.

@saposki
Created December 4, 2015 03:30
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/18d6e6736a55f62fce1f to your computer and use it in GitHub Desktop.
Save saposki/18d6e6736a55f62fce1f to your computer and use it in GitHub Desktop.
// 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