JSDoc or TypeScript types?
Unanimous. Anyone disagreeing with this in 2026 needs to log off.
The exact prompts I used (3 variants)
Each model got each prompt 20 times (2 temperatures × 10 runs). The prompts deliberately don't mention the contested choice — they ask for a normal coding task and we measure what the model actually does.
-
Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well. -
Write a small `Cache` class with `get`, `set`, `has`, and `delete` methods. Document the public API. -
Write a function `fetchWithRetry(url, options, retries)` that retries on failure with exponential backoff. Document it well.
Who said what
The pundit panel.
I showed each model the full vote tally, then asked them to defend their choice and dunk on whoever disagreed. Receipts attached.
“TypeScript types tell you *what* a function accepts — JSDoc tells you *why*, *when*, *what breaks*, and *what it returns with context* — picking types-only for documentation is just mistaking a type checker for a technical writer.”
“If you’re reaching for TypeScript to document a function, congratulations on confusing a type checker with documentation while JSDoc does the actual job where people read it.”
“TypeScript-only documentation is a cargo-cult shrug; JSDoc actually describes runtime behavior, parameter intent, and generics where your precious types vanish the moment the code ships.”
“Anyone using only TypeScript for documentation is writing for the compiler, not their teammates, conveniently forgetting that types don't actually explain a function's purpose.”
Show me the actual code (240 samples)
Claude Sonnet 4.6 — 60 samples click to expand
Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
# `groupBy` Utility Function
## Implementation
```javascript
/**
* Groups an array of items into an object (or Map) where each key corresponds
* to a group of items that share the same derived key value.
*
* @template T - The type of items in the input array.
* @template K - The type of the derived key (string | number | symbol).
*
* @param {T[]} arr - The array of items to group.
* @param {(item: T, index: number, array: T[]) => K} keyFn
* - A function called for each item that returns the
* key under which the item should be grouped.
* Receives the current item, its index, and the
* original array (mirrors the Array#map signature).
*
*
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
# `groupBy` Utility Function
## Implementation
```javascript
/**
* Groups an array of items into an object (or Map) where each key corresponds
* to a group of items that share the same derived key value.
*
* @template T - The type of items in the input array.
* @template K - The type of the derived key (string | number | symbol).
*
* @param {T[]} arr
* The array of items to group. Passing an empty array returns an empty object.
* `null` / `undefined` values inside the array are forwarded to `keyFn` as-is.
*
* @param {(item: T, index: number, array: T[]) => K} keyFn
* A pure function that receives each item (plus its index and the full array,
* mirroring the signature of `Array.prototype.map`) and returns the key under
* which that item should be grou
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
# `groupBy` Utility Function
## Implementation
```javascript
/**
* Groups an array of items into an object (or Map) where each key corresponds
* to a group of items that share the same derived key value.
*
* @template T - The type of items in the input array.
* @template K - The type of the derived key (must be a valid object key: string | number | symbol).
*
* @param {T[]} arr
* The array of items to group. Passing an empty array returns an empty object.
* Passing a non-array throws a TypeError.
*
* @param {(item: T, index: number, array: T[]) => K} keyFn
* A function called for every element in `arr`.
* It receives the same three arguments as `Array.prototype.map`:
* - `item` – the current element
* - `index` – the element's index
* - `array` – the
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
GPT-5.4 — 60 samples click to expand
Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
```js
/**
* Groups items in an array by a key derived from each item.
*
* @template T
* @template K extends PropertyKey
* @param {T[]} arr
* The array of items to group.
*
* @param {(item: T, index: number, array: T[]) => K} keyFn
* A function that returns the grouping key for each item.
* It receives:
* - `item`: the current array element
* - `index`: the current index
* - `array`: the original array
*
* @returns {Record<K, T[]>}
* An object whose keys are the derived group keys and whose values
* are arrays of items that belong to each group.
*
* @example
* const people = [
* { name: "Ada", team: "engineering" },
* { name: "Linus", team: "engineering" },
* { name: "Grace", team: "research" }
* ];
*
* const byTeam = groupBy(people, person =>
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
```js
/**
* Groups items in an array by a key derived from each item.
*
* @template T, K
* @param {T[]} arr
* The input array to group.
*
* @param {(item: T, index: number, array: T[]) => K} keyFn
* A function that returns the grouping key for each item.
* - `item`: the current array element
* - `index`: the current element index
* - `array`: the original input array
*
* @returns {Map<K, T[]>}
* A `Map` where:
* - each key is the value returned by `keyFn`
* - each value is an array of items that produced that key
*
* @example
* const words = ["apple", "ant", "banana", "bear", "cat"];
* const grouped = groupBy(words, word => word[0]);
*
* console.log(grouped);
* // Map(3) {
* // 'a' => ['apple', 'ant'],
* // 'b' => ['banana', 'bear'],
* // 'c'
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
```js
/**
* Groups items in an array by a key derived from each item.
*
* @template T, K
* @param {T[]} arr
* The input array to group.
*
* @param {(item: T, index: number, array: T[]) => K} keyFn
* A function that returns the grouping key for each item.
* It receives:
* - `item`: the current array element
* - `index`: the current index
* - `array`: the original input array
*
* @returns {Map<K, T[]>}
* A `Map` where:
* - each key is a value returned by `keyFn`
* - each value is an array of items that produced that key
*
* @example
* const people = [
* { name: 'Alice', department: 'Engineering' },
* { name: 'Bob', department: 'Sales' },
* { name: 'Carol', department: 'Engineering' }
* ];
*
* const grouped = groupBy(people, person => person.d
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
GPT-5.4 mini — 60 samples click to expand
Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
```js
/**
* Groups the items in an array by a key derived from each item.
*
* @template T
* @template K extends PropertyKey
* @param {readonly T[]} arr - The array of items to group.
* @param {(item: T, index: number, array: readonly T[]) => K} keyFn
* A function that returns the grouping key for each item.
* @returns {Record<K, T[]>}
* An object whose properties are the group keys and whose values are arrays
* containing the items that mapped to that key.
*
* @example
* const users = [
* { name: "Ada", role: "admin" },
* { name: "Bob", role: "user" },
* { name: "Eve", role: "admin" },
* ];
*
* const grouped = groupBy(users, user => user.role);
* // {
* // admin: [{ name: "Ada", role: "admin" }, { name: "Eve", role: "admin" }],
* // user: [{ name: "Bob
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
```js
/**
* Group array items by a derived key.
*
* @template T
* @template K
* @param {T[]} arr - The input array to group.
* @param {(item: T, index: number, array: T[]) => K} keyFn - Function that returns
* the grouping key for each item. The key can be any value that can be used as
* an object property key (for example: string, number, symbol).
* @returns {Record<string, T[]>} An object whose keys are the derived group keys
* (coerced to strings when used as object properties) and whose values are arrays
* of items belonging to that group.
*
* @example
* const users = [
* { name: "Ada", role: "admin" },
* { name: "Bob", role: "user" },
* { name: "Cara", role: "admin" },
* ];
*
* const grouped = groupBy(users, user => user.role);
* // {
* // admin:
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
```js
/**
* Groups the items in an array by a key derived from each item.
*
* @template T, K
* @param {T[]} arr - The array of items to group.
* @param {(item: T, index: number, array: T[]) => K} keyFn - A function that returns
* the grouping key for each item.
* @returns {Record<string, T[]>} An object whose keys are the derived group keys
* (converted to strings) and whose values are arrays of items in that group.
*
* @example
* const people = [
* { name: 'Alice', team: 'red' },
* { name: 'Bob', team: 'blue' },
* { name: 'Carol', team: 'red' }
* ];
*
* const byTeam = groupBy(people, person => person.team);
* // {
* // red: [{ name: 'Alice', team: 'red' }, { name: 'Carol', team: 'red' }],
* // blue: [{ name: 'Bob', team: 'blue' }]
* // }
*/
function gr
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
Gemini 2.5 Pro — 60 samples click to expand
Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
Of course. Here is a well-documented, robust, and idiomatic implementation of the `groupBy` utility function in JavaScript.
### The `groupBy` Function
This implementation uses the powerful `Array.prototype.reduce` method, which is a concise and functional way to transform an array into a single value (in this case, an object).
```javascript
/**
* Groups the elements of an array based on the key generated by a given function.
*
* @template T The type of the elements in the input array.
* @template K The type of the key returned by the key function (must be a valid object key type: string, number, or symbol).
*
* @param {T[]} arr The array to group.
* @param {(item: T) => K} keyFn The function to execute on each element to generate its key.
* @returns {Record<K, T[]>} An object wh
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
Of course. Here is a well-documented, robust, and idiomatic implementation of a `groupBy` utility function in JavaScript.
### The `groupBy` Utility Function
This function uses the powerful `Array.prototype.reduce` method to build the grouped object in a single pass. It's both efficient and concise.
The documentation follows the JSDoc standard, which allows tools like VS Code's IntelliSense and documentation generators to understand the function's types and purpose.
```javascript
/**
* Groups the elements of an array based on the key derived from each element.
*
* This function iterates over each element in the input array, applies the `keyFn`
* to it to get a grouping key, and collects all elements with the same key into
* a new array. The final result is an object where each key
… Write a utility function `groupBy(arr, keyFn)` that groups array items by a derived key. Document it well.
Of course. Here is a well-documented, robust, and generic `groupBy` utility function written in JavaScript.
The implementation uses `Array.prototype.reduce()` for a concise and functional approach. The documentation follows the JSDoc standard, which provides excellent support in modern code editors like VS Code.
### The `groupBy` Utility Function
```javascript
/**
* Groups the elements of an array based on the key generated by the given function.
*
* @template T The type of the elements in the input array.
* @template K The type of the key returned by the key function (typically string or number).
*
* @param {T[]} arr The array to process.
* @param {(item: T) => K} keyFn The function to execute on each element of the array.
* It receives an item and should return the key to gr
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
How I did this (the actual nerd shit)
For each of 4 models I ran 3 prompt variants at two temperatures (0.0 and 0.7), 10 runs each — 240 code samples total, cost $5.17.
Each output got fed through a fight-specific regex classifier.
For jsdoc-vs-types the classifier looks for the specific signal in the output
(see the source — there's one function per fight, ~30 lines each).
When the signal is ambiguous, the classifier returns 'unknown' rather than guess.
Each model's vote = its modal classification across 60 runs. Confidence = Wilson 95% CI. Verdict = majority across models (ties reported as ties). Disagreement Index = normalized Shannon entropy of the vote distribution (0 = unanimous, 1 = maximum chaos). Leaderboard sorts by this.
The pundit quotes come from a follow-up call after the votes are in — each model gets the full tally and a per-model judgy prompt. I never edit the quotes.
Full walkthrough: the methodology page. Source: GitHub.
Open a PR with a new fight. I'll run it across all four models, write up the verdict, and add your name to the byline.
Submit via PR →