feat: resolucao da funcao maxValue

This commit is contained in:
Guilherme de Camargo Barbosa 2022-10-29 16:17:27 -03:00
parent 7983706a5a
commit 67faa57ff2

View File

@ -1,4 +1,12 @@
export function maxValue(values) {
// implementar logica aqui
}
if(values.length == 0) return 0
const maxValue = values.reduce(function(a, b) {
return Math.max(a, b);
}, -Infinity);
return maxValue
}
maxValue([10, 40, 30, 20, 50]) // 50