message: Add comments
  Minor refactoring
diff: function anagrams(word, words) {
  - let ans = [];
  - let sortedWord = word.split("").sort().join("");
  + let anagrams = [];
  + const sortedWord = word.split("").sort().join(""); // sorted word
  for (const w of words) {
  - if (w.length === word.length && w.split("").sort().join("") === sortedWord) {
  - ans.push(w);
  + if (
  + w.length === word.length && // if the length is not same, then there is no need to check for sorted condition
  + w.split("").sort().join("") === sortedWord
  + ) {
  + anagrams.push(w);
  }
  }
  - return ans;
  + return anagrams;
  }
  