feat: resolve longestWords
This commit is contained in:
parent
d68e3bd4d9
commit
9efc455565
@ -1,4 +1,18 @@
|
|||||||
export function longestWords(words) {
|
export function longestWords(words) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
let big = "";
|
||||||
|
|
||||||
|
words.forEach(word => {
|
||||||
|
if(word.length > big.length){
|
||||||
|
big = word
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = words.filter(word => {
|
||||||
|
if(word.length === big.length){
|
||||||
|
return word
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return result
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user