From fed221dd713433c47d05ba90e0fc05fa3013551d Mon Sep 17 00:00:00 2001 From: tiago rodrigues Date: Wed, 2 Nov 2022 16:30:21 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Finalizando=20terceiro=20exerc=C3=ADcio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 0541041..2a1fcc5 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,6 +1,14 @@ export function maxValue(values) { - // implementar logica aqui - + if (values.length === 0) { + return 0; + + } + + else { + let maxNumber = values.reduce((a, b) => Math.max(a, b)) + + return maxNumber; + } }