- Notifications
You must be signed in to change notification settings - Fork6.7k
[SAO FT2 - DE - W1D3] Marianna Dobal#769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
var longest=[]; | ||
for (let i = 0; i < words.length; i += 1) { | ||
if (longest.length < words[i].length) { | ||
return longest = words[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Não retornar diretamente aqui, primeiro armazenar numa variável qual a maior palavra. Caso contrário, retornará sempre a primeira ocorrência de maior palavra, não vai comparar com todo o array.
} else if (longest.length == words[i].length){ | ||
return longest = words[i]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Retornar aqui a variável contendo a maior palavra
// Calculate the Average | ||
var numbersAvg = [2, 6, 9, 10, 7, 4, 1, 9]; | ||
function averageNumbers(numbersAvg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Considerar a possibilidade de array vazio:numbersAvg.length = 0
e também se nenhum valor for passado ao argumento:numbersAvg = undefined
if (wordsUnique[i].indexOf() === - 1){ | ||
newArr.push(wordsUnique[i]); | ||
} | ||
else {continue;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Linha 97 é desnecessária
for (let i = 0; i < wordsFind.length; i += 1) { | ||
if (wordsFind[i].toLowerCase() === searchWord.toLowerCase()) { | ||
return true; | ||
} else {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Se não há condicional noelse
ou se for algo comocontinue;
, não precisa colocar oelse
.
thebinaryfelix left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Boa!
#checked
No description provided.