Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
undefined vs. typeof vs. in vs. hasOwnProperty
Object lookup performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/128.0.6613.98 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 128
Operating system:
iOS 17.6
Device Platform:
Mobile
Date tested:
one year ago
typeof
40.7M/s
hasOwnProperty
37.5M/s
in
37.4M/s
bool
36.5M/s
undefined
13.7M/s
View exact numbers
Test name
Executions per second
✓
typeof
40,674,016 Ops/sec
hasOwnProperty
37,452,332 Ops/sec
in
37,408,256 Ops/sec
bool
36,471,480 Ops/sec
undefined
13,694,841 Ops/sec
Script Preparation code:
var obj = { a: 1, b: 2, c: 3, d: 4, e: 5 };
Tests:
undefined
undefined !== obj.d;
typeof
'undefined' !== typeof obj.d;
in
'd' in obj;
hasOwnProperty
obj.hasOwnProperty( 'd' );
bool
!! obj.d;