From 70f64ffee393856577bcbed6e2a44f170afef1c6 Mon Sep 17 00:00:00 2001 From: RodrigoJorge Date: Fri, 28 Oct 2022 15:01:52 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20implementa=20fun=C3=A7=C3=A3o=20do=20va?= =?UTF-8?q?lor=20maximo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03-maxValue/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..7384fc2 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,13 @@ export function maxValue(values) { // implementar logica aqui - + let maior = -100; + for(let i = 0;i < values.length;i++){ + if(values[i] > maior){ + maior = values[i]; + } + } + if (values.length == 0){ + maior = 0; + } + return maior; } \ No newline at end of file -- 2.34.1