JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

JavaScript

class A {
  // name = 'Batman';
  
  constructor () {
    this.name = 'Batman';
  }
  
  getName () {
    return this.name;
  }
}

class B extends A {
  constructor (name) {
    super();
    this.name = name;
  }
}

const bObj = new B('Petya');
console.log(bObj.getName());