8000 Update calculator.js · M-Munk/javascript-exercises@645cbc7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 645cbc7

Browse files
authored
Update calculator.js
The reduce() method syntax for callbacks assigns the accumulator value followed by the currentValue, so I think the above variables should be switched.
1 parent 01aace2 commit 645cbc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

calculator/calculator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function subtract(a, b) {
77
}
88

99
function sum(array) {
10-
return array.reduce((current, total) => total + current, 0);
10+
return array.reduce((total, current) => total + current, 0);
1111
}
1212

1313
function multiply(array) {

0 commit comments

Comments
 (0)
0