Last active
July 18, 2018 23:54
-
-
Save caiogranero/ca8e947e83c4d7854ca26227b03006c2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 User { | |
constructor(firstName, lastName) { | |
this._firstName = firstName; | |
this._lastName = lastName; | |
} | |
get fullName() { | |
console.log(this._firstName + " " + this._lastName); | |
} | |
set firstName(name) { | |
this._firstName = name; | |
} | |
set lastName(name) { } | |
} | |
const user = new User("Jon", "Snow") | |
user.fullName; // Jon Snow | |
user.firstName = "Joon" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment