feat: funcao sum

This commit is contained in:
Caio Thurler 2022-10-30 19:37:14 -03:00
parent 91dc23ae6e
commit 77da09fea6

View File

@ -1,4 +1,8 @@
export function sum(values) { export function sum(values) {
// implementar logica aqui // implementar logica aqui
let total = 0
for (let i = 0; i < values.length; i++) {
total += values[i]; // adiciona o valor do indice (que aumenta com o loop) no total
}
return total // torna values = total
} }