Skip to content

Commit 75e8e8c

Browse files
authored
Update 01_loop_sum_reduce_version.js (egonSchiele#232)
the first parameter of the reduce function is `previousValue` and the second parameter is `currentValue` so these parameter names need to be fixed.
1 parent 3081486 commit 75e8e8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

04_quicksort/ES6/01_loop_sum_reduce_version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
* @param {Array} array Array of numbers
44
* @returns {number} Sum of the numbers
55
*/
6-
const sumReduce = array => array.reduce((curr, prev) => curr + prev);
6+
const sumReduce = array => array.reduce((prev, curr) => prev + curr);
77

88
console.log(sumReduce([1, 2, 3, 4])); // 10

0 commit comments

Comments
 (0)