[英]JavaScript: Create a function defineFirstArg that accepts a function and an argument; Accept More Arguments
第三个测试条件说的是参数,而不是参数,因此也许您需要尝试使用传播算子
const defineFirstArg = (inputFunc, arg) => {
return function (...addtionalArgs) {
return inputFunc(arg, ...addtionalArgs)
}
}
f2 = defineFirstArg(console.log,"x")
f2("y","z",'f')
//x y z f
散布参数并执行无限数量的参数传递的函数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.