refactor: altera solucao maxValue

This commit is contained in:
Rafael Sampaio de Oliveira 2022-10-28 15:01:37 -03:00
parent e6a9ae42a3
commit 1231f40660

View File

@ -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;
}
}