Merge pull request 'refactor: altera solucao maxValue' (#11) from feature/solucao-maxValue into development

Reviewed-on: #11
This commit is contained in:
Rafael Sampaio de Oliveira 2022-10-28 18:02:51 +00:00
commit 793756bbf2

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