From 9efc45556522af09274188b6299608974c82190b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naian=20F=C3=A9lix?= Date: Fri, 28 Oct 2022 10:51:39 -0300 Subject: [PATCH] feat: resolve longestWords --- 10-longestWords/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..9f9607f 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,18 @@ export function longestWords(words) { // 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 } \ No newline at end of file