I\'ve created a function that checks if 2 words are anagrams, but I want to make it better. I feel the declaration of the counter after in the if statement is not quite well, if
function checkAnagram(string1, string2) { return string1.replace(/[^\w]/g,'').toLowerCase().split('').sort().join('') === string2.toLowerCase().replace(/[^\w]/g,'').split('').sort().join('') }