Document
{"ScriptPreparationCode":null,"TestCases":[{"Name":"using methods","Code":"let string = \u0022Alireza\u0022\r\n\r\nfunction doer () {\r\n return [...string].sort().join(\u0022\u0022) == \u0022alireza\u0022\r\n}\r\n\r\n\r\ndoer()","IsDeferred":false},{"Name":"without methods","Code":"let isAnagram = function(s, t) {\r\n if (s.length !== t.length) {\r\n return false;\r\n }\r\n \r\n let freq = new Array(26).fill(0);\r\n for (let i = 0; i \u003C s.length; i\u002B\u002B) {\r\n freq[s.charCodeAt(i) - \u0027a\u0027.charCodeAt(0)]\u002B\u002B;\r\n freq[t.charCodeAt(i) - \u0027a\u0027.charCodeAt(0)]--;\r\n }\r\n \r\n for (let i = 0; i \u003C freq.length; i\u002B\u002B) {\r\n if (freq[i] !== 0) {\r\n return false;\r\n }\r\n }\r\n \r\n return true;\r\n};\r\n\r\n\r\nisAnagram(\u0022name\u0022 , \u0022mane\u0022)","IsDeferred":false}]}