Merge pull request 'feat(home):resolucao da questao 10' (#10) from feature/exercicio10 into development
Reviewed-on: #10
This commit is contained in:
commit
a3c6be8a5a
@ -1,4 +1,20 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
let allArray = [];
|
||||||
|
let longest = [];
|
||||||
}
|
for (let i=0; i<words.length; i++){
|
||||||
|
if(longest < words[i].length){
|
||||||
|
longest = words[i].length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let j =0; j < words.length; j++){
|
||||||
|
if(words[j].length == longest){
|
||||||
|
allArray.push(words[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(allArray.length == 1){
|
||||||
|
return allArray[0].split()
|
||||||
|
}else{
|
||||||
|
return allArray
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user