From 04c26faffdba629fe43e66493e485e2914caa24a Mon Sep 17 00:00:00 2001 From: Filipe Quintanilha Date: Fri, 28 Oct 2022 13:00:39 -0300 Subject: [PATCH] feat(longestWords): desenvolvimento da funcao --- 10-longestWords/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..9f71697 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,15 @@ export function longestWords(words) { // implementar logica aqui - + let maior = 0; + for (const palavra of words){ + if (palavra.length > maior) + maior = palavra.length; + } + + const arr = []; + words.map(element=>{ + if (element.length === maior) + arr.push(element); + }) + return arr; } \ No newline at end of file