maior palavra terminado

This commit is contained in:
Mickael_cypriano 2022-11-02 18:09:01 -03:00
parent f0b5de1440
commit 98f234c01b

View File

@ -1,4 +1,17 @@
export function longestWords(words) {
// implementar logica aqui
}
var longest = "";
for (var word of words) {
if (word.length > longest.length) longest = word;
}
return longest;
}
// Resultados esperados
console.log(longestWords(["abacaxi", "melancia", "banana"]))
console.log(longestWords(["aba", "aa", "ad", "vcd", "aba"]))
console.log(longestWords(["aa"]))
console.log(longestWords(["abc", "eeee", "abcd", "dcd"]))
console.log(longestWords(["aa", "bb", "cc"]))
console.log( longestWords([ "a", "abc", "cbd", "zzzzzz", "a", "abcdef", "asasa", "aaaaaa"]))