feat(longestWords): implementa function
This commit is contained in:
parent
7acb5a25b3
commit
adbda1f636
@ -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;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user