undefined vs typeof vs in vs hasOwnProperty vs boolFastest: in (2.6x faster)
40,256,368 ops/sec
40,030,328 ops/sec
40,006,620 ops/sec
36,303,760 ops/sec
15,278,778 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| undefined | |
| typeof | |
| in | |
| hasOwnProperty | |
| bool |
| Test name | Executions per second |
|---|---|
| ✓ in | 20,244,816 Ops/sec |
| typeof | 20,021,340 Ops/sec |
| bool | 19,194,742 Ops/sec |
| hasOwnProperty | 18,133,332 Ops/sec |
| undefined | 7,440,731 Ops/sec |