forked from M3-Academy/challenge-algorithms-v2.0
add sum logic
This commit is contained in:
parent
996757b693
commit
9e52cbd5d4
@ -1,4 +1,6 @@
|
|||||||
export function sum(values) {
|
export function sum(values) {
|
||||||
// implementar logica aqui
|
if (values.length == 0) return 0;
|
||||||
|
const val = values.reduce((accumulator, value) => accumulator + value, 0);
|
||||||
|
|
||||||
|
return val;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user