From 9b3ac56a7c7358b738805daaaefd1480bcdce5ff Mon Sep 17 00:00:00 2001 From: Eleonora Otz Date: Tue, 1 Nov 2022 11:55:33 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Soluciona=20o=20exerc=C3=ADcio=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10-longestWords/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..e9c2f7e 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,19 @@ export function longestWords(words) { // implementar logica aqui + + let longestWord = '' + words.forEach((word) => { + if(word.length > longestWord.length){ + longestWord = word + } + }); + + const longestWords = words.filter((word) => { + if(word.length === longestWord.length){ + return word + } + }); + + return longestWords } \ No newline at end of file