refactor: altera solucao maxValue #11

Merged
Rafael_Sampaio_de_Oliveira merged 1 commits from feature/solucao-maxValue into development 2022-10-28 18:02:51 +00:00
Showing only changes of commit 1231f40660 - Show all commits

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