add sum logic

This commit is contained in:
Marcela Mathias 2022-11-02 18:04:26 -03:00
parent 996757b693
commit 9e52cbd5d4

View File

@ -1,4 +1,6 @@
export function sum(values) {
// implementar logica aqui
}
if (values.length == 0) return 0;
const val = values.reduce((accumulator, value) => accumulator + value, 0);
return val;
}