Merge pull request 'feat(longestWords): implementa funcao longestWords' (#10) from feature/longestWords into development
Reviewed-on: #10
This commit is contained in:
commit
d8e4ec0883
@ -1,4 +1,13 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
let maioresPalavras = [];
|
||||||
|
let auxiliar=words[0];
|
||||||
|
for(let i=0;i<words.length;i++){
|
||||||
|
if(auxiliar.length < words[i].length)
|
||||||
|
auxiliar = words[i]
|
||||||
|
}
|
||||||
|
for(let i=0;i<words.length;i++)
|
||||||
|
if(auxiliar.length == words[i].length)
|
||||||
|
maioresPalavras.push(words[i]);
|
||||||
|
return maioresPalavras;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user