From d1f05007e034d593fbc1a19e50d0e0a9786789d9 Mon Sep 17 00:00:00 2001 From: Victor Souza Date: Tue, 1 Nov 2022 15:52:04 -0300 Subject: [PATCH] =?UTF-8?q?refactor(maxValue):=20melhorando=20o=20c=C3=B3d?= =?UTF-8?q?igo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 03-maxValue/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/03-maxValue/index.js b/03-maxValue/index.js index 1d6e66d..5e89651 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,8 +1,8 @@ export function maxValue(values) { let resultOfMaxValue = Math.max(...values) - if(values === null) { - resultOfMaxValue = 0 + if(values.length === 0) { + return 0 } return resultOfMaxValue