feat(challenge-6): completed challenge

This commit is contained in:
Henrique Santos Santana 2022-10-27 21:03:44 -03:00
parent 2814f545d4
commit e9fc82de97

View File

@ -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);
} }