From 4a24ab356320522ab672da2bc45b9eed1ce08286 Mon Sep 17 00:00:00 2001 From: Nicolas Oliveira <110689312+thedevnicolas@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:39:05 -0300 Subject: [PATCH] feat(desafio06):desafio-completo --- 06-sum/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..ebdc89d 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,13 @@ export function sum(values) { // implementar logica aqui - + if (values.length === 0) { + + return 0; + } + + let sum = values.reduce(function(accumulator,value){ + return accumulator + value; +}) + +return sum } \ No newline at end of file