== vs ===

Benchmark created on


Setup

const objs = [];
for (let i = 0; i < 1000; i++) {
	objs.push({id: i});
}

Test runner

Ready to run.

Testing in
TestOps/sec
===
const y = objs.find(obj => obj.id === 773);
console.log(y);
ready
==
const y = objs.find(obj => obj.id == 773);
console.log(y);
ready
=== with cast to number
const y = objs.find(obj => +obj.id === +'773');
console.log(y);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.