Created
December 27, 2019 07:52
-
-
Save sunguru98/8265baeeef731e3cf5e6913ba4eadc42 to your computer and use it in GitHub Desktop.
Markdium-Functional Programming vs Object Orietned programming in JavaScript
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
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