Merge branch 'feature/10-longestWords' into development

This commit is contained in:
Andrea Matsunaga 2022-11-01 14:01:38 -03:00
commit 79cbe613e8

View File

@ -1,4 +1,13 @@
export function longestWords(words) { export function longestWords(words) {
// implementar logica aqui
let sortedWords = words.sort((a, b) => b.length - a.length);
let maxLength = sortedWords[0].length
let longestWords = []
for (let word of sortedWords) {
if(word.length != maxLength) break;
longestWords.push(word)
}
return longestWords;
} }