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

14 lines
250 B
JavaScript

export function maxValue(values) {
// implementar logica aqui
let maxV = values[0]
for(let i = 1; i < values.length; i++) {
if(maxV < values[i]){
maxV = values[i]
}
}
if(values.length == 0)
return 0;
return maxV;
}