Created
June 3, 2018 20:36
-
-
Save arrbxr/b76fdd38356447b1bfb98cf8bd00f04b 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 Book { | |
constructor(author){ | |
this._author = author; | |
} | |
//getter | |
get writer(){ | |
return this._author; | |
} | |
//setter | |
set writer(updatedAuthor){ | |
this._author = updatedAuthor; | |
} | |
} | |
const lol = new Book('anonymous'); | |
console.log(lol.writer); | |
lol.writer = 'wut'; | |
console.log(lol.writer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment