From 8aa3869a4fd5a6398b94fb250b475bfbffeceab2 Mon Sep 17 00:00:00 2001 From: amanda almeida Date: Fri, 28 Oct 2022 15:26:05 -0300 Subject: [PATCH] =?UTF-8?q?feat(maxValue):=20Adiciona=20a=20logica=20do=20?= =?UTF-8?q?algoritmo=20que=20retorna=20o=20maior=20valor=20de=20um=20array?= =?UTF-8?q?=20de=20n=C3=BAmeros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03-maxValue/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..82e278b 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,9 @@ export function maxValue(values) { // implementar logica aqui - + if (values.length === 0) { + return 0; + } else { + const maxValue = Math.max(...Object.values(values)); + return maxValue + } } \ No newline at end of file