Skip to content

Instantly share code, notes, and snippets.

View PaulAsaf2's full-sized avatar
🏠

Pavel Asafov PaulAsaf2

🏠
View GitHub Profile
@JonAbrams
JonAbrams / gist:7edaa3545f8fd11a1919
Created July 9, 2015 23:15
How to add getter/setter methods to ES6 classes after the class is created
// Also works for normal methods
class User {
constructor (first, last) {
this.firstName = first;
this.lastName = last;
}
}
Object.defineProperty(User.prototype, 'name', {
get: function () {