javascript
Runtime: 136 ms, faster than 67.24% of JavaScript online submissions for Group Anagrams.\nMemory Usage: 49.7 MB, less than 71.58% of JavaScript online submissio
*Runtime*: **136 ms**, faster than **67.24%** of JavaScript online submissions for Group Anagrams.\n*Memory Usage*:** 49.7 MB**, less than **71.58%** of JavaScript online submissions for Group Anagrams.\n\n```\n/**\n * @param {string[]} strs\n * @return {string[][]}\n */\nconst groupAnagrams = function(strs) {\n    let groups = {}\n    strs.forEach(str => {\n        const sortedStr = str.split(\'\').sort().join(\'\')\n        if (groups[sortedStr]) {\n            groups[sortedStr].push(str)\n        } else {\n            groups[sortedStr] = [str]\n        }\n    })\n    return Object.values(groups)\n};\n```
[]