// Function to check if two strings are anagrams
function areAnagrams(str1, str2) {
  const sortedStr1 = str1.split('').sort().join('');
  const sortedStr2 = str2.split('').sort().join('');
  return sortedStr1 === sortedStr2;
}
// Example usage
const word1 = 'listen';
const word2 = 'silent';
const anagramCheck = areAnagrams(word1, word2);
console.log(anagramCheck);
