class Component { constructor(dom) { console.log('Parent class constructor executed!'); this.dom = dom; } onCreate() { return true; } } class Collection extends Component { constructor(dom,flag){ super(dom); this.flag=flag; } // }
- class Component {
- constructor(dom) {
- console.log('Parent class constructor executed!');
- this.dom = dom;
- }
- onCreate() {
- return true;
- }
- }
class Collection {- class Collection extends Component {
- constructor(dom,flag){
- super(dom);
- this.flag=flag;
- }
- //
- }
class Component { constructor(dom){ this.dom = dom; } onCreate() { return this.dom; } } const comp = new Component(); comp.onCreate();
function Component(dom) {this.dom = dom;this.onCreate = function() {- class Component {
- constructor(dom){
- this.dom = dom;
- }
- onCreate() {
- return this.dom;
- }
}- }
- const comp = new Component();
- comp.onCreate();