-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[PTREMOTE] - Ana Pais #3843
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[PTREMOTE] - Ana Pais #3843
Conversation
} | ||
let longestWord; | ||
for (let i = 0; i < words.length; i++) { | ||
if (!longestWord || words[i].length > longestWord.length) { |
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.
Lo que podemos hacer aqui para remover ese !longestWord es inicializar la palabra como un string vacio
function findLongestWord(words) {
if (words.length === 0) {
return null;
}
let longestWord = "";
for (let i = 0; i < words.length; i++) {
if (words[i].length > longestWord.length) {
longestWord = words[i]
}
}
return longestWord
}
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.
asi podemos remover la priemra ocndicion del if y funcionaria sin problema :D
if(wordsArr.length === 0) { | ||
return null; | ||
} | ||
let sum = wordsArr.join('').length; |
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.
🔥 Excelente forma de resolverlo
Excelente trabajo Ana! 🚀 la iteracion Bonus 3, podria ser algo asi
|
This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
No description provided.