diff --git a/03-maxValue/index.js b/03-maxValue/index.js index a78ce0f..93d537a 100644 --- a/03-maxValue/index.js +++ b/03-maxValue/index.js @@ -1,8 +1,12 @@ export function maxValue(values) { // implementar logica aqui + let max = values.reduce(function (a, b) { + return Math.max(a, b); + }, -Infinity); + if (values.length === 0) { return 0; } else { - return Math.max.apply(null, values); + return max; } }