Hello! Please help me with this question: we have a parent class that is responsible for selecting the html document by classes:
function gtClassName(аргумент не передавал намерено, что бы разобраться с наследованием){ this.ElemClass = null; this.gtElemClas = document.getElementsByClassName(this.ElemClass); } There is also a heir class that accepts all properties of the parent class:
function gtClassButtons(Buttons){ gtClassName.call(this); this.ElemClass = Buttons; return this.gtElemClas.ElemClass; } After I create a class object:
var b = new gtClassButtons('B'); console.log(b); I get the result:
gtClassButtons {ElemClass: "B", gtElemClas: HTMLCollection[0]} An empty HTML collection, but ElemClass no longer null .
People, tell me how to fix it and, if possible, explain why this approach was a failure.