challenge-algorithms-v2.0-d.../10-longestWords/index.js

12 lines
368 B
JavaScript
Raw Normal View History

2022-10-30 15:48:44 +00:00
import { arrayBuffer } from "stream/consumers";
export function longestWords(words) {
// implementar logica aqui
let maioresPalavras = "";
for ( const word of words ) {
if ( word.length > maioresPalavras.length ) {
maioresPalavras = word; }
}
return words.filter ( ( word ) => word.length == maioresPalavras.length ) ;
2022-10-30 15:48:44 +00:00
}