在overloadedFunc中,您需要將multiply作為默認值(不要調用函數);你需要打電話給arg3。 您可以簡化multiply函數以返回映射。 const multiply = (arr, n) => Array.isArray(arr) ? arr.map(x => x * n) : arr * n;const overloadedFunc = ( arg1 = [1, 2, 3], arg2 = 2, arg3 = multiply) => arg3(arg1, arg2);console.log(overloadedFunc()); // [2, 4, 6]console.log(overloadedFunc([2, 4, 6], 3)); // [6, 12, 18]console.log(overloadedFunc(10)); // 20 .as-console-wrapper { top: 0; max-height: 100% !important; } 這可以是re-written以簡化arg3(又名multiply)回調。 const multiply = (scalar, multiplier) => scalar * multiplier;const overloadedFunc = ( arg1 = [1, 2, 3],