Created
January 26, 2019 16:13
-
-
Save gotraveltoworld/25b18c4f6064cde52fcc8a67d479bcfe to your computer and use it in GitHub Desktop.
To explain the Javascript Object.create().
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
const testOne = { | |
'attr': 'origin', | |
} | |
testTwo = Object.create(testOne); // This is a testOne's inheritance. | |
console.log(testTwo.attr); | |
delete testTwo.attr; | |
console.log(testTwo.attr); // To show 'origin', because this prototype of testTwo is testOne. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment