challenge-algorithms-v2.0-g.../03-maxValue/index.js

12 lines
251 B
JavaScript
Raw Normal View History

export function maxValue(values) {
// implementar logica aqui
2022-10-29 19:17:27 +00:00
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