feat(longestWords): implementa function

This commit is contained in:
Cainã Milech 2022-10-28 23:46:59 -03:00
parent 7acb5a25b3
commit adbda1f636

View File

@ -1,4 +1,22 @@
export function longestWords(words) {
// implementar logica aqui
let maior = '';
let maiores = [];
for(let palavra of words){
if(palavra.length > maior.length){
maior = palavra;
}
}
let caracteres = maior.length;
for(let palavra of words){
if(caracteres === palavra.length){
maiores.push(palavra);
}
}
return maiores;
}