jquery

$到底做了什么?

jquery把元素包装成为了jquery的实例,这个实例继承了jquery的原型方法,这样子我们才能使用jquery的方法

链式调用原理

是在每个方法后return this

const fn = {
    fn1: function() {
        console.log("do something");
        return this;
    },
    fn2: function() {
        console.log("do something");
        return this;
    },
    fn3: function() {
        console.log("do something");
        return this;
    }
}
fn.fn1().fn2().fn3();
原文地址:https://www.cnblogs.com/qxp140605/p/13629246.html