challenge-algorithms-v2.0-m.../06-sum/index.js

9 lines
208 B
JavaScript
Raw Permalink Normal View History

export function sum(values) {
2022-11-02 23:13:46 +00:00
// implementar logica aqui
let valorInicial = 0
return values.reduce(
(valorAnterior, valorAtual) => valorAnterior + valorAtual,
valorInicial
)
}