Created
March 12, 2024 11:34
-
-
Save wentout/c65ed2b096e03828de282704f7a73778 to your computer and use it in GitHub Desktop.
improved Eric Elliott's instanceof lies example
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
function foo() { }; | |
const bar = { a: 'a' }; | |
Object | |
.setPrototypeOf( | |
foo.prototype, | |
bar | |
); | |
const baz = Object.create(foo.prototype); | |
console.log(baz instanceof foo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://medium.com/javascript-scene/common-misconceptions-about-inheritance-in-javascript-d5d9bab29b0a