Created
October 11, 2018 09:16
-
-
Save ogiermaitre/8f9e9eeffb0f074a5dcc33fda17025af to your computer and use it in GitHub Desktop.
[Prototype tips] Some fun with javascript prototy #javascript
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
| const house = { | |
| set houseColor(color){ | |
| this.color = color | |
| }, | |
| toString(){ | |
| return this.color | |
| } | |
| } | |
| const myHouse = Object.create(house) | |
| myHouse.houseColor = 'white' | |
| console.log(myHouse.toString()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment