Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
instanceof Array vs Array.isArray()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
instanceof Array
2815.7 Ops/sec
Array.isArray()
2878.6 Ops/sec
Script Preparation code:
var arr = new Array(1000).fill(null); for(let i = 0; i < arr.length; i++) { if(i % 3 === 0) { arr[i] = [1]; } else if(i % 2 === 0) { arr[i] = {a: 1}; } else { arr[i] = '1'; } }
Tests:
instanceof Array
let circle = 5; while(circle > 0) { const check = arr.map(item => item instanceof Array); circle--; }
Array.isArray()
let circle = 5; while(circle > 0) { const check = arr.map(item => Array.isArray(item)); circle--; }