Anagram in javascript