学习笔记
2019-07-22 本文已影响0人
f359be24fd04
es5里面的类
例子代码
function Dog(){
this.name="dog";
this.age=1;
}
var dog=new Dog();
console.log(dog.name);
es6里面的类
class Dog{
name:string;
constructor(cname:string){
this.name=cname;
}
jump():void{
console.log(this.name);
}
}