JS高阶函数

    function compose(f,g){
        return function(){
            console.log(arguments);
            return f.call(null,g.apply(null,arguments));
        }
    }
    var f = function(x){return x*x};
    var g = function(x,y){return x+y};

    var sg = compose(f,g);
    console.log(sg(1,2,3));

// argments [1,2,3]
// 结果输出 9
原文地址:https://www.cnblogs.com/sstone/p/8493545.html