Не понял наследование в классах js, именно методов

Проблема в наследовании метода, есть класс и метод к нему

class Button {
constructor(width, height, background, value, cssClass) {
    this.width = width,
    this.height = height,
    this.background = background,
    this.value = value,
    this.cssClass = cssClass
}
render() {
    let a = document.createElement('button');
    a.style.width = this.width + 'px';
    a.style.height = this.height + 'px';
    a.style.backgroundColor = this.background;
    a.textContent = this.value;
    a.classList.add(this.cssClass);  
    document.body.append(a)
    return a;        
}}

и есть наследник

class ModernButton extends Button {
constructor(width, height, background, value, cssClass, borderRadius = (0 + 'px')) {
    super(width, height, background, value, cssClass);
    this.borderRadius = borderRadius;
}
render() { 
    super.render();
    a.style.borderRadius = this.borderRadius + 'px';
    return a; 
}}

проблема в том что в строчке a.style.borderRadius = this.borderRadius + 'px'; он не видет обьект а, но он наследуется. Подскажите пожалуйста в чем проблема? Спасибо!!


Ответы (1 шт):

Автор решения: Igor
render() { 
    let a = super.render();
    a.style.borderRadius = this.borderRadius + 'px';
    return a; 
}
→ Ссылка