JSFiddle - React, Tailwind, and code Playground

JavaScript

function Parent(name) {
    this.name = name
}

function Child() {

}

function wrongInherit(Child, Parent) {
    Child.prototype = new Parent()
    Child.prototype.constructor = Parent
}

wrongInherit(Child, Parent)
console.log(new Child().name) // undefined, but exists
console.log('name' in new Child) // true
console.log(new Child().constructor.name) // Parent

function inherit(Child, Parent) {
    Child.prototype = Object.create(Parent.prototype)
    Child.prototype.constructor = Child
}

inherit(Child, Parent)
console.log('name' in new Child) // false
console.log(new Child instanceof Parent) // true
console.log(new Child().constructor.name) // Child