function functionFunction(str) {
return function(str1){
return str+", "+str1;
};
}
console.log(functionFunction("hello")("world"));//hello, world
如果不限制传递的参数的个数:
function functionFunction(str) {
var arr1=Array.prototype.slice.call(arguments);
return function(str1){
return arr1.concat(Array.prototype.slice.call(arguments)).join(", ");
};
}
console.log(functionFunction("hello","lwf")("你好"));//hello, lwf, 你好
更多讨论:
https://www.nowcoder.com/questionTerminal/1f9fd23cdfd14675ab10207191e1d035