Created
December 20, 2019 00:18
-
-
Save bathos/edc8d240c4ebc94ec1909ce73f953953 to your computer and use it in GitHub Desktop.
home-obj.js
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
class Foo extends Bar { | |
method() { | |
const homeObject = Foo.prototype; | |
const superReferenceBase = Object.getPrototypeOf(homeObject); | |
} | |
static method() { | |
const homeObject = Foo; | |
const superReferenceBase = Object.getPrototypeOf(homeObject); | |
} | |
} | |
const foo = { | |
__proto__: Bar.prototype, | |
method() { | |
const homeObject = foo; | |
const superReferenceBase = Object.getPrototypeOf(homeObject); | |
} | |
}; | |
// homeObject stays the same even if methods are called with strange receivers | |
// however super ref base can change is homeObject[[Prototype]] changes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment