链式编程

function Student(id,name){
    this.id = id;
    this.name = name;
    this.eat = function(food){
        console.log("吃"+food);
        return this;
    },
    this.sleep = function(){
        console.log("睡");
        return this;
    }
    }

    var stu =new Student(1001,"张三");
    stu.eat("").sleep().eat("").sleep().eat("").sleep().eat("").sleep();
    //链式编程     jqerry同理
posted @ 2021-11-04 16:37  六月沉  阅读(36)  评论(0)    收藏  举报