From d6eb8289d74914251c6abcc748d14a7c570f0eb0 Mon Sep 17 00:00:00 2001 From: Emilly Date: Tue, 1 Nov 2022 14:48:48 -0300 Subject: [PATCH] 08-resolvido --- 08-isAnagram/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..345bfcf 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,12 @@ export function isAnagram(word1, word2) { // implementar logica aqui - + if (word1.length != word2.length){ + return false; + } + + let str1 = word1.toUpperCase().split("").sort().join(""); + let str2 = word2.toUpperCase().split("").sort().join(""); + + let resultado = str1 === str2 + return resultado; } \ No newline at end of file