forked from M3-Academy/challenge-algorithms-v2.0
feat(desafio06):desafio-completo
This commit is contained in:
parent
2ed084cc0b
commit
4a24ab3563
@ -1,4 +1,13 @@
|
|||||||
export function sum(values) {
|
export function sum(values) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
if (values.length === 0) {
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let sum = values.reduce(function(accumulator,value){
|
||||||
|
return accumulator + value;
|
||||||
|
})
|
||||||
|
|
||||||
|
return sum
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user