ErrorCode_将函数作为参数的连续嵌套

        function a(arg) {
            console.log('this is a');
            arg();
        }

        function b(arg) {
            console.log('this is b');
            arg();
        }

        function c(arg) {
            console.log('this is c');
            arg();
        }

        function d() {
            console.log('this is d');
            console.log(this.e);
            
        }
        var e = 77;
        a(d);
        console.log('-------');
        a(b(c(d)));

函数作为参数的连续嵌套调用是不可维持的,原因是第二个函数作为参数是已经被调用的函数了,不能再次被调用

posted @ 2020-07-10 19:32  Syinho  阅读(176)  评论(0编辑  收藏  举报