Array.isArray vs instanceof vs [].constructor vs Object.prototype.toStringFastest: Array.isArray (2.7x faster)
28,831,434 ops/sec
13,802,926 ops/sec
11,090,538 ops/sec
10,690,595 ops/sec
Fastest: Array.isArray (3.8x faster)
321,930,816 ops/sec
112,879,824 ops/sec
89,737,136 ops/sec
84,029,952 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Array.isArray | |
| instanceof | |
| [].constructor | |
| Object.prototype.toString |
| Test name | Executions per second |
|---|---|
| ✓ Array.isArray | 91,864,968 Ops/sec |
| [].constructor | 83,292,072 Ops/sec |
| instanceof | 73,008,160 Ops/sec |
| Object.prototype.toString | 42,540,872 Ops/sec |