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