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