Skip to content

Instantly share code, notes, and snippets.

@sunguru98
Created December 27, 2019 07:52
Show Gist options
  • Save sunguru98/8265baeeef731e3cf5e6913ba4eadc42 to your computer and use it in GitHub Desktop.
Save sunguru98/8265baeeef731e3cf5e6913ba4eadc42 to your computer and use it in GitHub Desktop.
Markdium-Functional Programming vs Object Orietned programming in JavaScript
class Plant {
constructor(name, colour = green) {
this.name = name
this.colour = colour
this.height = 10
}
grow() {
this.height++
return this.height
}
}
class Aloevera extends Plant {
constructor(name, colour, size) {
super(name, colour)
this.size = size
}
giveJelly() {
this.height--
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment