Complete the JavaScript function to determine whether two given strings are anagrams of each other. The function should return true if both strings are anagrams. Else, return false.
An anagram of a string is another string that contains the same characters, only the order of characters can be different.
For example: