Group By Property — JavaScript easy interview problem
Given an array of objects `items` and a string `key`, group items by `item[key]`. Return a plain object whose keys are the property values (stringified) and values are arrays of matching items (preserve input order). Example: `groupBy([{type:"a",v:1},{type:"b",v:2},{type:"a",v:3}], "type")` → `{ a: [...], b: [...] }`.
Tags: hashmap, grouping
Practice this HashMap & Set problem free in the JS Interview Playground with automated tests and unlockable solutions.