forked from M3-Academy/challenge-algorithms-v2.0
11 lines
147 B
JavaScript
11 lines
147 B
JavaScript
export function sum(values) {
|
|
if (values.length) {
|
|
|
|
return values.reduce(function (soma, i) {
|
|
|
|
return soma + i
|
|
})
|
|
}
|
|
return 0
|
|
|
|
} |