1function isAnagram(stringA, stringB) {
2 // Sanitizing
3 stringA = stringA.toLowerCase().replace(/[\W_]+/g, "");
4 stringB = stringB.toLowerCase().replace(/[\W_]+/g, "");
5
6 // sorting
7 const stringASorted = stringA.split("").sort().join("");
8 const stringBSorted = stringB.split("").sort().join("");
9
10 return stringASorted === stringBSorted;
11}