From 46270818563a9bfe50ddaf0c97db6365c4a4e9dd Mon Sep 17 00:00:00 2001 From: Carlos Lins Date: Thu, 27 Oct 2022 20:38:09 -0300 Subject: [PATCH] feat: Algoritmo 08-isAnagram - finalizado --- 08-isAnagram/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..0168375 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,16 @@ export function isAnagram(word1, word2) { // implementar logica aqui + const compare = str => + str + .toLowerCase() + .split('') + .sort() + .join(''); + + if(compare(word1) === compare(word2)){ + return true; + } + + return false; } \ No newline at end of file