+ 1

how to deal with two super() in java script

suppose i have two classes: class A extends HTMLElement{ constructor(){ super(); //to access "this" of HTMLElement } } class B extends A{ constructor(){ super(); //to access "this" of class A } } but this shows error: Illegal constructor at new A (xyz.js:6) // saying that super() of class A is an illegal constructor at new B(xyz.js:15) // saying the same as above at xyz.js:23 plz help !!! how can i fix this .

29th Apr 2019, 8:07 PM
S O U ✌️ I K
S O U ✌️ I K - avatar
1 Odpowiedź
+ 1
you have to register your custom element in CustomElementRegistry using the define() method: https://code.sololearn.com/Wbo21pXOB5ZV/#js https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements
29th Apr 2019, 11:48 PM
MO ELomari
MO ELomari - avatar