Created
March 30, 2021 23:56
-
-
Save mageowl/a9c6dede24aa3ec16852ac1e808a630f to your computer and use it in GitHub Desktop.
Syntactic sugar.
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 Property { | |
constructor(name, value) { | |
this.arr = [name, value]; | |
} | |
} | |
class Name extends Property { | |
constructor("name", "Owen") // static constructor, values are passed directly to "super". | |
/* | |
constructor() { | |
super("name", "Owen") | |
} | |
*/ | |
change(value) { | |
this.arr = ["name", value] | |
} | |
} | |
let myName = new Name(); | |
myName.arr // ["name", "Owen"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment