Skip to content

Instantly share code, notes, and snippets.

@Storyyeller
Created December 29, 2017 04:37
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 Storyyeller/fd3daab2cfba563a45d28e119054434d to your computer and use it in GitHub Desktop.
Save Storyyeller/fd3daab2cfba563a45d28e119054434d to your computer and use it in GitHub Desktop.
function Child(...args) {
const {constructor} = Object.getPrototypeOf(homeObject);
const $this = Reflect.construct(constructor, args, new.target);
// initialize subclass properties
$this.x = 43;
return $this;
}
Object.setPrototypeOf(Child, Base);
Object.setPrototypeOf(Child.prototype, Base.prototype);
const homeObject = Child.prototype;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment