链式调用原理

var testFn = function () {}
testFn.prototype = {
  fn1: function () {
    console.log(this);
    console.log('fn1');
    return this;
  },
  fn2: function () {
    console.log(this);
    console.log('fn2');
    return this;
  },
  fn3: function () {
    console.log(this);
    console.log('fn3');
    return this;
  }
};
var testFn = new testFn();
testFn.fn1().fn2().fn3();

链式调用本质是: 实例化的函数调用原型对象上的方法;

https://www.tongbiao.xyz/
原文地址:https://www.cnblogs.com/tongbiao/p/10008443.html