refactor: altera solucao maxValue

This commit is contained in:
Rafael Sampaio de Oliveira 2022-10-28 14:46:00 -03:00
parent c6f6df9c59
commit 2ff2ba659b

View File

@ -1,4 +1,12 @@
export function maxValue(values) {
// implementar logica aqui
var max = values.reduce(function (a, b) {
return Math.max(a, b);
}, -Infinity);
if (values.length === 0) {
return 0;
} else {
return max;
}
}