forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(challenge-6): completed challenge' (#6) from feature/challenge-6 into develop
Reviewed-on: #6
This commit is contained in:
commit
e650ec9d21
@ -1,4 +1,9 @@
|
|||||||
export function sum(values) {
|
export function sum(values) {
|
||||||
// implementar logica aqui
|
// 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