以下是使用 `Array.prototype.reduce` 方法实现的函数: ```javascript function processArray(arr, func) { return arr.reduce((accumulator, currentValue) => { accumulator.push(func(currentValue)); return accumulator; }, []); } let inputArray = [1, 2, 3]; let processingFunction = function(x) { return x * 2; }; console.log(processArray(inputArray, processingFunction)); ``` [2024-11-11 20:59:07 | AI写代码神器 | 105点数解答]