From 5aebe7e4f92ee998ce4a36fbe3092cdd0cb1741b Mon Sep 17 00:00:00 2001 From: Carlos Scantbelruy Date: Fri, 28 Oct 2022 08:59:53 -0400 Subject: [PATCH] retornando a maior palavra de um array --- 10-longestWords/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/10-longestWords/index.js b/10-longestWords/index.js index a98d2d8..9d3e1b3 100644 --- a/10-longestWords/index.js +++ b/10-longestWords/index.js @@ -1,4 +1,7 @@ export function longestWords(words) { - // implementar logica aqui - -} \ No newline at end of file + var longest = ""; + for (var word of words) { + if (words.length > longest.length) longest = words; + } + return longest; +}