instanceof vs Array.isArray

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
instanceof
const results = [];
for(let i = 0; i < 1e6; i++) {
	results.push([] instanceof Array);
}
ready
Array.isArray
const results = [];
for(let i = 0; i < 1e6; i++) {
	results.push(Array.isArray([]));
}
ready

Revisions

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