feat(maxValue): Adicionando algoritmo que retorna o valor maximo de um vetor.

This commit is contained in:
Savio Carvalho Moraes 2022-10-30 14:36:39 -03:00
parent 5c5d0859ef
commit e74fc971cf

View File

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