{"ScriptPreparationCode":null,"TestCases":[{"Name":"1","Code":"function isAnagram(stringA, stringB) {\r\n const sanitizeString = function (str) {\r\n return str.toLowerCase().replace(/[^a-z\\d]/g, \u0027\u0027).split(\u0027\u0027).sort().join(\u0027\u0027);\r\n }\r\n return sanitizeString(stringA) == sanitizeString(stringB)\r\n}","IsDeferred":false},{"Name":"2","Code":"function isAnagram(stringA, stringB) {\r\n\r\n function createCharMap(text) {\r\n let charMap = {}\r\n\r\n for (let char of text) {\r\n if (charMap.hasOwnProperty(char)) {\r\n charMap[char]\u002B\u002B\r\n } else {\r\n charMap[char] = 1\r\n }\r\n }\r\n\r\n return charMap\r\n }\r\n\r\n if (stringA.length === stringB.length) {\r\n let stringAMap = createCharMap(stringA)\r\n let stringBMap = createCharMap(stringB)\r\n for (let char in stringAMap) {\r\n if (stringAMap[char] !== stringBMap[char]) {\r\n return false\r\n }\r\n }\r\n return true\r\n } else {\r\n return false\r\n }\r\n}","IsDeferred":false}]}