forked from M3-Academy/challenge-algorithms-v2.0
12 lines
251 B
JavaScript
12 lines
251 B
JavaScript
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
|