forked from M3-Academy/challenge-algorithms-v2.0
feat: resolucao da funcao maxValue
This commit is contained in:
parent
7983706a5a
commit
67faa57ff2
@ -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
|
Loading…
Reference in New Issue
Block a user