javascript chained constructor call +

all

Simple chain call:

        function person() {

            this.run = function () {
                console.log("跑了");
                return this;

            };
            this.eat = function () {
                console.log("吃了");
                return this;
            }
        }

        var p = new person();
        p.run().eat();    

As a simple call logic chain just inside the corresponding object as this method will return a return value of the call chain to reach out

Guess you like

Origin www.cnblogs.com/wangtong111/p/11242557.html