function Me(name) { this.name=name; //对象方法 this.Introduce=function(){ alert("My name is "+this.name); } } //类方法 Me.Like=function(){ alert("LOL"); } //原型方法 Me.prototype.IntroduceCn=function(){ alert("我的名字是"+this.name); } //测试开始 var p1=new Me("小白"); p1.Introduce(); Me.Like(); p1.IntroduceCn();
相关文章: