JSFiddle - React, Tailwind, and code Playground

by LyndseyB

JavaScript

class Person {
	constructor(name, age) {
    	this.name = name;
        this.age = age;
    },
    
    getName() {
    	return this.name;
    }
}

class Car extends Person {
	constructor(name, age) {
    	super(name, age);
    }
}

const sim = new Person("simon", 30);
const volvo = new Car("volvo", 20);

console.log(sim);
console.log(volvo);