A word-game app needs to show which of the player's guesses use exactly the same letters. Write groupAnagrams(words), which groups words that are anagrams of each other: same letters, same counts, any order.
groupAnagrams(['listen', 'stone', 'silent', 'notes', 'enlist', 'apple', 'onset']);
// [
// ['listen', 'silent', 'enlist'],
// ['stone', 'notes', 'onset'],
// ['apple'],
// ]
['ab', 'ab'] → [['ab', 'ab']]).a–z only. The empty string is a valid word.Spotted a mistake or a rights concern? Report an issue