forked from M3-Academy/challenge-algorithms-v2.0
15 lines
232 B
JavaScript
15 lines
232 B
JavaScript
export function maxValue(values) {
|
|
let max = 0;
|
|
max = values[0];
|
|
|
|
if (values.length === 0){
|
|
return 0;
|
|
}
|
|
|
|
for(let i= 0; i < values.length; i++) {
|
|
if (values[i] > max) {
|
|
max = values[i];
|
|
}
|
|
}
|
|
return max;
|
|
} |