Skip to content

Commit 535624d

Browse files
committed
reduce function implement
1 parent 2f2d5e6 commit 535624d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sprint-1/implement/sum.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
function sum(elements) {
2+
return elements
3+
.filter(e => typeof e === "number")
4+
.reduce((total,num) => total + num, 0);
25
}
36

47
module.exports = sum;

0 commit comments

Comments
 (0)