0
0
GGGiovanny Gongora
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation, and special characters).
const isAnagram = (str1: string, str2: string) => {
const normalize = (str: string) =>
str
.toLowerCase()
.replace(/[^a-z0-9]/gi, '')
.split('')
.sort()
.join('');
return normalize(str1) === normalize(str2);
};