function Test(){
this.name='123'
}
var test=new Test()
console.log(test.name)
function Person(name,age){
this.name="geyao"
this.age=18
}
function Programmer(name,age){
Person.apply(this,[name,age])
this.work="Programmer"
}
var p=new Programmer("geyao",18)
console.log(p)
运行结果