forked from M3-Academy/challenge-algorithms-v2.0
refactor: altera solucao maxValue
This commit is contained in:
parent
c6f6df9c59
commit
2ff2ba659b
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user