From 01ac558b062cb1fa9b9abee3611bfb06a2807776 Mon Sep 17 00:00:00 2001 From: vitorsoaresdev Date: Fri, 28 Oct 2022 11:45:34 -0300 Subject: [PATCH] feat: finalizado maxValue --- 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 e433b31..87d8610 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,4 +1,9 @@ export function maxValue(values) { // implementar logica aqui - + if(values.length == 0) return 0; + + return values.reduce((ac, value) => { + if(ac > value) return ac; + return value + }, ); } \ No newline at end of file