+ 1
My heading 1 is not display. I try it with value and object. Thanks you.
Display heading. https://code.sololearn.com/WWn5O6tTSYi8/?ref=app
2 Answers
0
the problem is with heading.value
You want text to be in between the tags. So use heading.textContent or heading.innerText
heading.value will look for value attribute which heading doesn't have.
0
class Myheading extends Heading {
constructor (value,color) {
super (value);
this.value = value;
this.color = color;
}
value () {
return this.value ;
}
color () {
return this.color ;
}
In this code you don't have to explicitly define value() method and this.value property. super(value) will do it for you.
class Myheading extends Heading {
constructor (value,color) {
super (value);
this.color = color;
}
color () {
return this.color ;
}
This will also work