用法
class Star{ constructor(name,age){ this.name=name; this.age=age; } } Star.prototype.sing=function(){ console.log(this.name+'会唱歌') } var ldh=new Star("刘德华",20) console.log(ldh) ldh.sing()
标签:Star,name,age,ldh,原型,prototype,构造函数 From: https://www.cnblogs.com/hs20011205/p/17010066.html