Skip to content

Instantly share code, notes, and snippets.

@wbarcovsky
Last active August 10, 2022 12:42
Show Gist options
  • Select an option

  • Save wbarcovsky/498f7b061af802c9c3c2dfa184b35534 to your computer and use it in GitHub Desktop.

Select an option

Save wbarcovsky/498f7b061af802c9c3c2dfa184b35534 to your computer and use it in GitHub Desktop.
class Parent {
constructor(params) {
Object.assign(this, params);
}
static fabric() {
return new Parent({ source: 'fabric', test: 1 });
}
title() {
return "I'm Parent";
}
}
class Children extends Parent {
title() {
return "I'm Children";
}
}
const parent = Parent.fabric();
const children = Children.fabric();
console.log(parent.title(), children.title());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment