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_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 17
Operating system:
iOS 17.5.1
Device Platform:
Mobile
Date tested:
one year ago
typeof
25.7M/s
in
25.4M/s
hasOwnProperty
24.6M/s
bool
24.3M/s
undefined
10.2M/s
View exact numbers
Test name
Executions per second
✓
typeof
25,701,230 Ops/sec
in
25,360,814 Ops/sec
hasOwnProperty
24,596,264 Ops/sec
bool
24,342,282 Ops/sec
undefined
10,240,495 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;