Skip to content

Commit 2bff346

Browse files
author
KatieAJenkins
committed
reduce 1 working
1 parent fc4edf7 commit 2bff346

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

reduce/core.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
'use strict';
2+
var input = [ 10, 15, 20, 25, 30, 35 ];
3+
// var expected = 135
14
function sum (array) {
25
// your code here
3-
};
6+
return array.reduce(function(initialValue, element){
7+
console.log(initialValue);
8+
console.log(element);
9+
return initialValue + element;
10+
});
11+
}
12+
13+
console.log(sum(input));
414

515
function productAll (array) {
616
// your code here
@@ -19,4 +29,4 @@ module.exports = {
1929
productAll: productAll,
2030
objectify: objectify,
2131
luckyNumbers: luckyNumbers
22-
};
32+
};

0 commit comments

Comments
 (0)