js的prototype原型设计模式
1.js对象的继承方式使用prototype原型模式。
2.js的方法可以分为以下三类:
a.类方法
b.对象方法
c.原型方法
function People(name)
{
  this.name=name;
  //对象方法
  this.Introduce=function(){
    alert("My name is "+this.name);
  }
}
//类方法
People.Run=function(){
  alert("I can run");
}
//原型方法
People.prototype.IntroduceChinese=function(){
  alert("我的名字是"+this.name);
}
 
//测试
var p1=new People("Windking");
p1.Introduce();
People.Run();
p1.IntroduceChinese();3.obj1.func.call(obj)方法
是将obj看成obj1,调用func方法
相关推荐
  zhongshish    2020-10-21  
   jinfeng0    2020-08-03  
   uileader    2020-07-18  
   jameszgw    2020-06-21  
   yanglin    2020-05-02  
   钟鼎    2020-05-01  
   嵌入式移动开发    2020-04-10  
   THEEYE    2020-03-26  
   嵌入式移动开发    2020-01-23  
   gougouzhang    2020-01-12  
   TingBen    2019-12-29  
   chvnetcom    2020-01-06  
   Mrwind    2019-11-03  
   chvnetcom    2019-10-29  
   baohuanlove    2019-08-16  
   nongshuqiner    2015-07-27  
   anqier    2019-07-01  
   Zhongmeishijue    2020-09-10  
   嵌入式移动开发    2020-08-17