天天看点

链式编程

function Student(id,name){

    this.id = id;

    this.name = name;

    this.eat = function(food){

        console.log("吃"+food);

        return this;

    },

    this.sleep = function(){

        console.log("睡");

    }

    var stu =new Student(1001,"张三");

    stu.eat("").sleep().eat("").sleep().eat("").sleep().eat("").sleep();

    //链式编程     jqerry同理

继续阅读