JSFiddle - React, Tailwind, and code Playground

JavaScript

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

function Child(name,age){
	this.age = age;
  Parent.apply(this,[name]);
}

Parent.prototype.say = function(){
	alert(this.name);
}

// 类式继承 子类原型继承父类
Child.prototype = new Parent();

var c1 = new Child('zhangsan', 123);

c1.say();