Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Object.hasOwnProperty vs Object in vs Object[] vs Array.indexOf vs Array.includes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
direct
2.6M/s
Object in
2.6M/s
Object.hasOwnProperty
2.4M/s
Array.indexOf
395K/s
Array includes
387K/s
View exact numbers
Test name
Executions per second
✓
direct
2,574,425 Ops/sec
Object in
2,566,891 Ops/sec
Object.hasOwnProperty
2,361,581 Ops/sec
Array.indexOf
395,477 Ops/sec
Array includes
386,734 Ops/sec
Script Preparation code:
var object = {}, array = [], i, test = 1000; for (i = 0; i < 1000; i++) { object['something' + i] = true; array.push('something' + i); }
Tests:
Object.hasOwnProperty
object.hasOwnProperty('something' + test)
Object in
('something' + test) in object
Array.indexOf
array.indexOf('something' + test) !== -1
direct
object['something' + test] === true
Array includes
array.includes('something' + test)