feature/longestWords #11

Merged
ViniciusDeniz merged 2 commits from feature/longestWords into master 2022-11-03 03:16:06 +00:00
Showing only changes of commit 612643df7e - Show all commits

View File

@ -1,4 +1,18 @@
export function longestWords(words) {
// implementar logica aqui
}
// implementar logica aqui
let comp = 0;
let resultado = [];
for (i in text) {
if (comp < text[i].length) {
comp = text[i].length;
resultado.push(text[i]);
}
}
if (resultado.length > 1) {
if (resultado[0].length < resultado[1].length) {
resultado.shift();
}
}
return resultado;
}