ts版本:
class Animal{
fullStr:string;
constructor(public color,public size,public age){
this.fullStr=color+' '+size+' '+age
}
}
let cat=new Animal("red","1KG","2")
js版本
let Animal =( function(){
function Animal(color,size,age){
this.color=color;
this.size=size;
this.age=age;
this.fullStr=color+' '+size+' '+age;
}
return Animal;
}())
let cat=new Animal("red","1KG","2")