From f669f37f274ed2d1fd0d1b0ab0741720b18ae094 Mon Sep 17 00:00:00 2001 From: Maria Carolina Date: Wed, 2 Nov 2022 12:29:59 -0300 Subject: [PATCH] isAnagram --- 08-isAnagram/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..441d09d 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,12 @@ export function isAnagram(word1, word2) { - // implementar logica aqui - -} \ No newline at end of file + word1 = word1.toUpperCase().split("").sort().join(""); + word2 = word2.toUpperCase().split("").sort().join(""); + return word1 === word2; +} + +console.log(isAnagram("roma", "amor")); //(true) +console.log(isAnagram("Buckethead", "DeathCubeK")); //(true) +console.log(isAnagram("Twoo", "WooT")); //(true) +console.log(isAnagram("dumble", "bumble")); //(false) +console.log(isAnagram("ound", "round")); //(false) +console.log(isAnagram("apple", "pale")); //(false)