From 955c3872fafb5718886539658eb7e5e9303fd7e8 Mon Sep 17 00:00:00 2001 From: ManuelaLuanaSchumackerTavares Date: Fri, 28 Oct 2022 16:09:30 -0300 Subject: [PATCH] feat(desafio): Adiciona sexta tarefa concluida --- 06-sum/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..e093771 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,17 @@ export function sum(values) { // implementar logica aqui - + let soma = 0; + if(values.length == 1){ + for(let i = 0; i < values.length; i++){ + soma = values[i]; + } + return soma; + }else if(values.length == []){ + return soma = 0; + }else{ + for(let i = 0; i < values.length; i++){ + soma += values[i]; + } + return soma; + } } \ No newline at end of file -- 2.34.1