From f97c5118c1c0c12696432ef04b0cc6361df42e9d Mon Sep 17 00:00:00 2001 From: ThiagoDuutra Date: Fri, 28 Oct 2022 16:11:53 -0300 Subject: [PATCH] feat: Resolvido questao maxValue --- 03-maxValue/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..103223c 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,12 @@ export function maxValue(values) { // implementar logica aqui - -} \ No newline at end of file + let maiorNumero = 0; + for (let i = 0; i < values.length; i++) { + if (values[i] >= maiorNumero) { + maiorNumero = values[i]; + } else if (maiorNumero == 0) { + maiorNumero = values[i]; + } + } + return maiorNumero; +} -- 2.34.1