标签:def under port TE ack text prototype AC fun
class Hello(x,y){ this.x=x; this.y=y; } Hello.protoype.add=function(){ return this.x +this.y; } const m =new Hello(2,3); console.log(m.add()); // 5 typeof Hello === "function" . //true Hello === Hello.prototype.constructor //true Hello.__proto__ === Hello.prototype //true
export class Hello() { constructor(x,y){ this.x = x; this.y = y; } add() { return this.x +this.y; } } const m =new Hello(2,3); console.log(m.add()); // 5 typeof Hello === "function" . //true Hello === Hello.prototype.constructor //true Hello.__proto__ === Hello.prototype //true
标签:def under port TE ack text prototype AC fun
原文地址:https://www.cnblogs.com/fuGuy/p/9215725.html