forked from M3-Academy/challenge-algorithms-v2.0
feat(challenge-6): completed challenge
This commit is contained in:
parent
2814f545d4
commit
e9fc82de97
@ -1,4 +1,9 @@
|
||||
export function sum(values) {
|
||||
// implementar logica aqui
|
||||
if (values.length === 0 || !values) return 0;
|
||||
|
||||
// acc é abreviação de accumulator(acumulador)
|
||||
return values.reduce((acc, number) => {
|
||||
return (acc += number);
|
||||
}, 0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user