JSFiddle - React, Tailwind, and code Playground
JavaScript
class Parent {
constructor(str_) {
console.log('Contructor: ', str_)
}
_fact(new_class, str_) {
if (new_class.prototype instanceof Parent) {
return new new_class(str_)
}
}
}
class Child extends Parent {
}
p = new Parent('hi');
c = p._fact(Child, 'bye');