feat(03-maxValue): Cria a função

This commit is contained in:
Leonardo Pereira Rocha 2022-10-28 18:31:47 -03:00
parent 2f5d5c9c03
commit 00dff8d136
2 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,5 @@
export function triangleArea(base, height) { export function triangleArea(base, height) {
let result; let result;
result = (base * height) / 2; result = (base * height) / 2;
return result return result;
} }

View File

@ -1,4 +1,15 @@
export function maxValue(values) { export function maxValue(values) {
// implementar logica aqui 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;
} }