Created
January 4, 2021 21:34
-
-
Save codingedgar/02f3ad4f4529c9b6194cd5fdc63d01bb 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
class Cat { | |
constructor(name) { | |
this._name = name | |
} | |
get name() { | |
console.log('get called', this._name); | |
return this._name | |
} | |
set name(value) { | |
// expensive logic, avoid unless really necessary | |
console.log('set called', value); | |
this._name = value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment