From 008f01d480c5662be3724f576c86a9b51d04fba0 Mon Sep 17 00:00:00 2001 From: Gabriel Ferraz Date: Fri, 28 Oct 2022 15:10:19 -0300 Subject: [PATCH] =?UTF-8?q?(08-isAnagram):=20implementa=C3=A7?= =?UTF-8?q?=C3=A3o=20do=20c=C3=B3digo=20isAnagram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08-isAnagram/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..64b56b2 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,14 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + if(word1.length == word2.length){ + const words1 = word1.toUpperCase().split("").sort(); + const words2 = word2.toUpperCase().split("").sort(); + if (words1.join() == words2.join()){ + return true + }else { + return false + } + } else { + return false + } } \ No newline at end of file