1.这里说得fn个参数,我知道应该跟arguments和在函数里面用return function(){}这种方式来写,但是就是写不明白
function add(a,b){
return a+b;
}
function square(a){
return a*a;
}
function plusOne(c){
return c+1;
}
//var result = plusOne(square(add(1,2))); //这种的直接的转化成下面的不会
//alert(result);
var addSquareAndPlusOne = composite(add,square,plusOne);
function composite(add,square,plusOne){
return function(){
//这里怎么写呢?谢谢指导
}
}
addSquareAndPlusOne(1,2);
第一种写法:
第二种写法: