[英]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.