forked from M3-Academy/challenge-algorithms-v2.0
13 lines
215 B
JavaScript
13 lines
215 B
JavaScript
export function sum(values) {
|
|
// implementar logica aqui
|
|
if (values.length === 0) {
|
|
|
|
return 0;
|
|
}
|
|
|
|
let sum = values.reduce(function(accumulator,value){
|
|
return accumulator + value;
|
|
})
|
|
|
|
return sum
|
|
} |