refactor: Muda variável Desafio 2.3

This commit is contained in:
Sabrina Miranda 2022-10-29 15:47:22 -03:00
parent 785173231e
commit cfb58393a4

View File

@ -1,12 +1,11 @@
export function maxValue(values) { export function maxValue(values) {
let valores = [...values]; let maiorValor = values[0];
let maiorValor = valores[0];
if(valores.length === 0) { if(values.length === 0) {
maiorValor = 0; maiorValor = 0;
}else { }else {
for(let i = 0 ; i < valores.length ; i++) { for(let i = 0 ; i < values.length ; i++) {
let valor = valores[i]; let valor = values[i];
if(valor > maiorValor) { if(valor > maiorValor) {
maiorValor = valor; maiorValor = valor;