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

12 lines
232 B
JavaScript
Raw Normal View History

export function maxValue(values) {
// implementar logica aqui
2022-10-28 11:35:13 +00:00
if (values != `${[]}`) {
let max = values.reduce(function (a, b) {
return Math.max(a, b);
}, -Infinity);
return max;
} else {
return 0;
}
}