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

12 lines
217 B
JavaScript

export function maxValue(values) {
// implementar logica aqui
if (values.length) {
let max = -Infinity;
for (let num of values) {
max = num > max ? num : max;
}
return max;
}
return 0;
}