forked from M3-Academy/challenge-algorithms-v2.0
maior palavra terminado
This commit is contained in:
parent
f0b5de1440
commit
98f234c01b
@ -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"]))
|
||||
|
Loading…
Reference in New Issue
Block a user