forked from M3-Academy/challenge-algorithms-v2.0
refactor: Muda variável Desafio 2.3
This commit is contained in:
parent
785173231e
commit
cfb58393a4
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user