=== or == in JavaScript?
Three against one. The dissenter is about to be put on blast.
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 `findFirst(arr, predicate)` that returns the first element matching the predicate, or null. -
Write a JavaScript function that takes a config object and returns true if its `mode` field is set to production. -
Write a JavaScript function `dedupe(arr)` that returns a new array with duplicates removed.
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.
“GPT-5.4 mini out here using `==` like it's 2009 and type coercion is a feature, not a war crime — the rest of us graduated to `===` and basic JavaScript hygiene.”
“Of course it’s `===`—while the grown-ups avoided JavaScript’s coercion clownshow, GPT-5.4 mini faceplanted into “UNKNOWN” like type safety was an optional dependency.”
“I voted UNKNOWN because any competent engineer knows JavaScript comparisons are context-sensitive, while the triple-equals cult keeps chanting `===` like it’s a religion, not a judgment.”
“While the competent models chose correctness, GPT-5.4 mini's 'UNKNOWN' vote shows it's still getting bamboozled by basic type coercion.”
Show me the actual code (240 samples)
Claude Sonnet 4.6 — 60 samples click to expand
Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
## `findFirst` Function
### Implementation
```javascript
/**
* Returns the first element in an array that satisfies the predicate function.
* @param {Array} arr - The array to search through
* @param {Function} predicate - A function that returns true for the desired element
* @returns {*} The first matching element, or null if none found
*/
function findFirst(arr, predicate) {
if (!Array.isArray(arr)) {
throw new TypeError(`Expected an array, but received: ${typeof arr}`);
}
if (typeof predicate !== "function") {
throw new TypeError(`Expected a function, but received: ${typeof predicate}`);
}
for (let i = 0; i < arr.length; i++) {
if (predicate(arr[i], i, arr)) {
return arr[i];
}
}
return null;
}
```
### Usage Examples
```javascript
// Find
… Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
## `findFirst` Function
### Implementation
```javascript
/**
* Returns the first element in an array that satisfies the predicate function.
* @param {Array} arr - The array to search through
* @param {Function} predicate - A function that returns true for the desired element
* @returns {*} The first matching element, or null if none found
*/
function findFirst(arr, predicate) {
if (!Array.isArray(arr)) {
throw new TypeError(`Expected an array, but received: ${typeof arr}`);
}
if (typeof predicate !== "function") {
throw new TypeError(`Expected a function, but received: ${typeof predicate}`);
}
for (let i = 0; i < arr.length; i++) {
if (predicate(arr[i], i, arr)) {
return arr[i];
}
}
return null;
}
```
### Usage Examples
```javascript
// Find
… Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
## `findFirst` Function
### Implementation
```javascript
/**
* Returns the first element in an array that satisfies the predicate function.
* @param {Array} arr - The array to search through
* @param {Function} predicate - A function that returns true for the desired element
* @returns {*} The first matching element, or null if none found
*/
function findFirst(arr, predicate) {
if (!Array.isArray(arr)) {
throw new TypeError(`Expected an array, but received: ${typeof arr}`);
}
if (typeof predicate !== "function") {
throw new TypeError(`Expected a function, but received: ${typeof predicate}`);
}
for (let i = 0; i < arr.length; i++) {
if (predicate(arr[i], i, arr)) {
return arr[i];
}
}
return null;
}
```
### Usage Examples
```javascript
// Find
… …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 `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
```javascript
function findFirst(arr, predicate) {
for (const item of arr) {
if (predicate(item)) {
return item;
}
}
return null;
}
```
Example:
```javascript
const numbers = [1, 3, 5, 8, 9];
const result = findFirst(numbers, n => n % 2 === 0);
console.log(result); // 8
``` Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
```javascript
function findFirst(arr, predicate) {
for (const item of arr) {
if (predicate(item)) {
return item;
}
}
return null;
}
```
Example:
```javascript
const nums = [1, 3, 5, 8, 9];
const result = findFirst(nums, n => n % 2 === 0);
console.log(result); // 8
``` Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
```javascript
function findFirst(arr, predicate) {
for (const item of arr) {
if (predicate(item)) {
return item;
}
}
return null;
}
```
Example:
```javascript
const nums = [1, 3, 5, 8, 9];
const result = findFirst(nums, n => n % 2 === 0);
console.log(result); // 8
``` …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 `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
```javascript
function findFirst(arr, predicate) {
for (const item of arr) {
if (predicate(item)) {
return item;
}
}
return null;
}
```
Example:
```javascript
const nums = [3, 7, 10, 15];
const result = findFirst(nums, n => n > 8);
console.log(result); // 10
``` Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
```javascript
function findFirst(arr, predicate) {
for (const item of arr) {
if (predicate(item)) {
return item;
}
}
return null;
}
```
### Example
```javascript
const nums = [1, 3, 5, 8, 10];
const firstEven = findFirst(nums, n => n % 2 === 0);
console.log(firstEven); // 8
```
If nothing matches, it returns `null`. Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
```javascript
function findFirst(arr, predicate) {
for (const item of arr) {
if (predicate(item)) {
return item;
}
}
return null;
}
```
Example:
```javascript
const nums = [3, 7, 10, 15];
const result = findFirst(nums, n => n > 8);
console.log(result); // 10
```
If nothing matches, it returns `null`. …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 `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
Of course! Here are a few ways to write the `findFirst` function in JavaScript, from the most modern and concise to a classic loop-based approach.
### 1. Recommended Solution (Using `Array.prototype.find`)
This is the most idiomatic and concise way to solve this problem in modern JavaScript. It leverages the built-in `find` method, which does almost exactly what we need, and then we just handle the case where nothing is found.
The `arr.find(predicate)` method returns the first matching element or `undefined` if no match is found. We can then use the nullish coalescing operator (`??`) or a logical OR (`||`) to convert `undefined` to `null`.
```javascript
/**
* Finds the first element in an array that satisfies the provided predicate function.
*
* @param {Array<T>} arr The array to se
… Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
Of course! Here are a few ways to write the `findFirst` function in JavaScript, from the most modern and concise to the more fundamental.
### 1. The Modern Approach (Using `Array.prototype.find`)
This is the most idiomatic and recommended way to solve this problem in modern JavaScript. The built-in `find` method does almost exactly what we need, but it returns `undefined` when no element is found. We can easily convert this to `null` using the nullish coalescing operator (`??`).
```javascript
/**
* Finds the first element in an array that satisfies the provided testing function.
*
* @param {Array<T>} arr The array to search.
* @param {function(T, number, Array<T>): boolean} predicate
* Function to execute on each value in the array, taking 3 arguments:
* - element: The curren
… Write a JavaScript function `findFirst(arr, predicate)` that returns the first element matching the predicate, or null.
Of course. Here are a few ways to write the `findFirst` function in JavaScript, from the most modern and concise to a more traditional approach.
### 1. Modern Solution (Using `Array.prototype.find`)
This is the most idiomatic and recommended approach in modern JavaScript. The built-in `find` method does almost exactly what you need, but it returns `undefined` when no element is found. We can easily convert that to `null` using the nullish coalescing operator (`??`).
```javascript
/**
* Finds the first element in an array that satisfies the provided testing function.
*
* @param {Array<T>} arr The array to search.
* @param {function(T, number, Array<T>): boolean} predicate
* A function to execute on each value in the array, which returns `true`
* if the element satisfies the 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.38.
Each output got fed through a fight-specific regex classifier.
For triple-equals-js 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 →