typeof check vs instanceof check vs constructor checkFastest: typeof check (8.1x faster)
637,304 ops/sec
403,398 ops/sec
78,844 ops/sec
Fastest: constructor check (9.9x faster)
1,108,089 ops/sec
1,043,740 ops/sec
112,270 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| typeof check | |
| instanceof check | |
| constructor check |
| Test name | Executions per second |
|---|---|
| ✓ typeof check | 885,966 Ops/sec |
| instanceof check | 452,259 Ops/sec |
| constructor check | 94,510 Ops/sec |