Skip to content

Instantly share code, notes, and snippets.

@bathos
Created December 20, 2019 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bathos/edc8d240c4ebc94ec1909ce73f953953 to your computer and use it in GitHub Desktop.
Save bathos/edc8d240c4ebc94ec1909ce73f953953 to your computer and use it in GitHub Desktop.
home-obj.js
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