From 7536d3d99d52d71311037010bcfd5a1016891d0d Mon Sep 17 00:00:00 2001 From: Caroline Moran Date: Fri, 28 Oct 2022 07:35:13 -0400 Subject: [PATCH] =?UTF-8?q?feat(maxValue):=20fazendo=20func=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03-maxValue/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index e433b31..c47fa02 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,11 @@ export function maxValue(values) { // implementar logica aqui - -} \ No newline at end of file + if (values != `${[]}`) { + let max = values.reduce(function (a, b) { + return Math.max(a, b); + }, -Infinity); + return max; + } else { + return 0; + } +}