We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cc276d0 commit d525648Copy full SHA for d525648
1 file changed
src/arrays.js
@@ -22,7 +22,7 @@ const map = (elements, cb) => {
22
return mappedArr;
23
};
24
25
-const reduce = (elements, cb, startingValue) => {
+const reduce = (elements, cb, startingValue = elements.shift()) => {
26
// Combine all elements into a single value going from left to right.
27
// Elements will be passed one by one into `cb`.
28
// `memo` is the starting value. If `memo` is undefined then make `elements[0]` the initial value.
0 commit comments