From 00d62e03df21d653342a68b9a72d709af9d08816 Mon Sep 17 00:00:00 2001 From: Maria Carolina Date: Wed, 2 Nov 2022 19:24:43 -0300 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=A3o?= 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 d379060..c984561 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,5 +1,10 @@ export function maxValue(values) { - return Math.max.apply(null,values) + if (values.length === 0) { + return 0; + }else { + return Math.max.apply(null,values) + + } } console.log(maxValue([4, 6, 12, 5])) //(12)