Skip to content

Instantly share code, notes, and snippets.

@gotraveltoworld
Created January 26, 2019 16:13
Show Gist options
  • Save gotraveltoworld/25b18c4f6064cde52fcc8a67d479bcfe to your computer and use it in GitHub Desktop.
Save gotraveltoworld/25b18c4f6064cde52fcc8a67d479bcfe to your computer and use it in GitHub Desktop.
To explain the Javascript Object.create().
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