function person(name){
        this.name=name;
        //构造函数内的属性 
        this.show=show;  
    }
    function show(){
        alert("Hello :"+this.name);
    }
    
    person.author="OBJECT";
    person.poem="Everything has its object, things are empty...";
    person.Sing=function(){
        alert(person.author+" -> "+person.poem);
    }
    person.prototype=person   //在此演化
    
    person.prototype.marry=function(){
        alert(this.name+" have married")
    }
    var p=new person("张三");
    p.Sing();    
    p.marry();   // 结婚了

相关文章:

  • 2022-12-23
  • 2018-09-21
  • 2021-12-24
  • 2022-12-23
  • 2021-06-25
  • 2021-01-01
  • 2022-01-10
  • 2022-12-23
猜你喜欢
  • 2021-05-20
  • 2022-12-23
  • 2021-04-26
  • 2022-02-26
  • 2021-08-29
相关资源
相似解决方案