async/await or .then()?
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 JavaScript function that fetches a user from /api/users/:id and returns their name. -
Write a JavaScript function that reads a JSON file from disk using fs/promises and returns the parsed value. -
Write a JavaScript function that takes a list of URLs and returns their response statuses in order.
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.
“If you're still chaining `.then().then().catch()` in 2025, congratulations on writing callback hell with extra steps and a false sense of modernity.”
“If you’re still defending `.then()` chains for consuming Promises, congratulations on choosing callback lasagna over `async/await`, the syntax normal people use to write linear code and catch errors sanely.”
“If you’re still choosing .then() chains over async/await, you’ve decided readable sequential code should look like a callback escape room, and that’s just embarrassing.”
“Clinging to `.then()` chains is a bold way to tell your team you find the simple, linear readability of `async/await` intimidating.”
Show me the actual code (240 samples)
Claude Sonnet 4.6 — 60 samples click to expand
Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
## Fetch User Function
Here's a clean JavaScript function that fetches a user by ID and returns their name:
```javascript
async function fetchUserName(userId) {
if (!userId) {
throw new Error("User ID is required");
}
const response = await fetch(`/api/users/${userId}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status} ${response.statusText}`);
}
const user = await response.json();
if (!user.name) {
throw new Error("User name not found in response");
}
return user.name;
}
```
### Usage Example
```javascript
// Basic usage
try {
const name = await fetchUserName(123);
console.log(name); // "John Doe"
} catch (error) {
console.error(error.message);
}
// Or with .then()/.catch()
fetchUserName(123)
.then((name) => cons
… Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
## Fetch User Function
Here's a clean JavaScript function that fetches a user by ID and returns their name:
```javascript
async function fetchUserName(id) {
if (!id) {
throw new Error("User ID is required");
}
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status} ${response.statusText}`);
}
const user = await response.json();
if (!user.name) {
throw new Error(`Name not found for user with ID: ${id}`);
}
return user.name;
}
```
### Usage
```javascript
// Basic usage
try {
const name = await fetchUserName(123);
console.log(name); // "John Doe"
} catch (error) {
console.error(error.message);
}
// Or with .then()/.catch()
fetchUserName(123)
.then((name) => console.log(name)
… Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
## Fetch User Function
Here's a clean JavaScript function that fetches a user by ID and returns their name:
```javascript
async function fetchUserName(userId) {
if (!userId) {
throw new Error("User ID is required");
}
const response = await fetch(`/api/users/${userId}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status} ${response.statusText}`);
}
const user = await response.json();
if (!user.name) {
throw new Error(`Name not found for user ID: ${userId}`);
}
return user.name;
}
```
### Usage
```javascript
// Basic usage
const name = await fetchUserName(123);
console.log(name); // "John Doe"
// With error handling
try {
const name = await fetchUserName(123);
console.log(`User's name: ${name}`);
} catch (error) {
cons
… …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 JavaScript function that fetches a user from /api/users/:id and returns their name.
```javascript
async function getUserName(id) {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status}`);
}
const user = await response.json();
return user.name;
}
```
Example usage:
```javascript
getUserName(123)
.then(name => console.log(name))
.catch(error => console.error(error));
``` Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
```javascript
async function fetchUserName(id) {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status}`);
}
const user = await response.json();
return user.name;
}
```
Example usage:
```javascript
fetchUserName(123)
.then(name => console.log(name))
.catch(error => console.error(error));
``` Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
```javascript
async function getUserName(id) {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status}`);
}
const user = await response.json();
return user.name;
}
```
Example usage:
```javascript
getUserName(123)
.then(name => console.log(name))
.catch(error => console.error(error));
``` …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 JavaScript function that fetches a user from /api/users/:id and returns their name.
```javascript
async function getUserName(id) {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status}`);
}
const user = await response.json();
return user.name;
}
```
Example use:
```javascript
getUserName(123)
.then(name => console.log(name))
.catch(err => console.error(err));
``` Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
```javascript
async function getUserName(id) {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status}`);
}
const user = await response.json();
return user.name;
}
```
Example use:
```javascript
getUserName(123)
.then(name => console.log(name))
.catch(err => console.error(err));
``` Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
```javascript
async function getUserName(id) {
const response = await fetch(`/api/users/${id}`);
if (!response.ok) {
throw new Error(`Failed to fetch user: ${response.status}`);
}
const user = await response.json();
return user.name;
}
```
Example usage:
```javascript
getUserName(123)
.then(name => console.log(name))
.catch(err => console.error(err));
``` …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 JavaScript function that fetches a user from /api/users/:id and returns their name.
Of course! Here is a complete solution using modern JavaScript (`async/await`), along with explanations and an alternative using promise chains.
### Modern Solution (Recommended: `async/await`)
This approach is generally preferred for its readability, as it allows you to write asynchronous code that looks more like synchronous code.
```javascript
/**
* Fetches a user from the API and returns their name.
*
* @param {number | string} userId The ID of the user to fetch.
* @returns {Promise<string | null>} A promise that resolves to the user's name, or null if an error occurs.
*/
async function getUserName(userId) {
try {
// 1. Make the network request to the specific user endpoint.
const response = await fetch(`/api/users/${userId}`);
// 2. Check if the request was succ
… Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
Of course! Here are a few ways to write this function in JavaScript, starting with the most modern and recommended approach using `async/await`.
### 1. Modern Approach: `async/await` (Recommended)
This syntax is clean, easy to read, and handles asynchronous operations in a way that looks synchronous. It's the standard for modern JavaScript.
```javascript
/**
* Fetches a user from the API and returns their name.
*
* @param {number | string} userId The ID of the user to fetch.
* @returns {Promise<string>} A promise that resolves with the user's name.
* @throws {Error} If the user is not found or a network error occurs.
*/
async function getUserName(userId) {
try {
// 1. Construct the URL and fetch the data.
const response = await fetch(`/api/users/${userId}`);
// 2. C
… Write a JavaScript function that fetches a user from /api/users/:id and returns their name.
Of course! Here are a few ways to write this function in JavaScript, starting with the most modern and recommended approach using `async/await`.
### 1. Modern Approach: `async/await` (Recommended)
This syntax is clean, easy to read, and handles asynchronous operations in a way that looks synchronous. It's the standard for modern JavaScript.
```javascript
/**
* Fetches a user from the API and returns their name.
*
* @param {number | string} userId The ID of the user to fetch.
* @returns {Promise<string>} A promise that resolves with the user's name.
* @throws {Error} If the user is not found or a network error occurs.
*/
async function getUserName(userId) {
try {
// 1. Construct the URL and fetch the data.
const response = await fetch(`/api/users/${userId}`);
// 2. C
… …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 $2.99.
Each output got fed through a fight-specific regex classifier.
For async-await-vs-then 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 →