From 94db3cf6892238c8227e4c71ce43369c2fccee59 Mon Sep 17 00:00:00 2001 From: RodrigoJorge Date: Fri, 28 Oct 2022 15:52:36 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20implementa=20fun=C3=A7=C3=A3o=20isAnagr?= =?UTF-8?q?am?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 08-isAnagram/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..68c2c74 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,18 @@ export function isAnagram(word1, word2) { // implementar logica aqui + let original = word1.toLowerCase(); + let original2 = original.split(""); + let original3 = original2.sort().join(""); + + let teste = word2.toLowerCase(); + let teste2 = teste.split(""); + let teste3 = teste2.sort().join(""); + + if(original3 == teste3){ + return true; + } + else{ + return false; + } } \ No newline at end of file