function Fn(){};
Fn.prototype = {
    constructor:Fn,
    a:function(){
        alert(1);
        return this;  //实现链式操作。即fn.a().b()
        //如果要fn.a().b().c()的话,就需要在b:function里面添加return this;
    },
    b:function(){
        alert(2);
    },
    c:function(){
        alert(3);
    }
};
var fn = new Fn();
fn.a().b();

 

相关文章:

  • 2021-05-19
  • 2021-08-16
  • 2022-12-23
  • 2021-11-05
  • 2021-08-20
  • 2021-11-12
  • 2021-10-02
猜你喜欢
  • 2021-09-30
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2022-01-19
相关资源
相似解决方案