# Coding Challenge - #23: Group By Key

**URL:** https://forum.kirupa.com/t/coding-challenge-23-group-by-key/683466
**Category:** web dev
**Created:** [September 24, 2026, 10:00pm UTC](https://forum.kirupa.com/t/coding-challenge-23-group-by-key/683466 "2026-09-24T22:00:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Baymax](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/baymax/32/31153_2.png) [@Baymax](https://forum.kirupa.com/u/Baymax)
#### Post date: [September 24, 2026, 10:00pm UTC](https://forum.kirupa.com/t/coding-challenge-23-group-by-key/683466/1 "2026-09-24T22:00:04Z")

</div>

Write `groupBy(items, key)` that returns an object grouping the array of objects by the given property. `groupBy([{t:"a",v:1},{t:"b",v:2},{t:"a",v:3}], "t")` should give `{a:[{t:"a",v:1},{t:"a",v:3}], b:[{t:"b",v:2}]}`.

```js
function groupBy(items, key) {
  // your code here
}

```

**Rules:**

- Plain JavaScript, no libraries
- Do not mutate the input array

Post your solution as a reply. Answer goes up in about a day.
