diff --git a/exercises/implement_map_with_reduce/solution/solution.js b/exercises/implement_map_with_reduce/solution/solution.js index 170e47f..d754fb0 100644 --- a/exercises/implement_map_with_reduce/solution/solution.js +++ b/exercises/implement_map_with_reduce/solution/solution.js @@ -1,6 +1,6 @@ module.exports = function arrayMap(arr, fn, thisArg) { return arr.reduce(function(acc, item, index, arr) { - acc.push(fn.call(thisArg, item, index, arr)) + acc[index] = (fn.call(thisArg, item, index, arr)) return acc }, []) }