Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
includes_vs_IndexOf
(version: 0)
Comparing performance of:
includes vs indexOf
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var m=[] for(i=0; i<10000; i++){ m[i]=(Math.random()*10000)|0; } var n=0;
Tests:
includes
n=0 for(i=500; i<1000; i++){ if(m.includes(i))n++; } n;
indexOf
n=0 for(i=500; i<1000; i++){ if(m.indexOf(i)>=0)n++; } n;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
includes
indexOf
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Fill array with random integers
For Loops Teflora Test
IndexOf_vs_includes
at(-1) vs (length - 1)
Comments
Confirm delete:
Do you really want to delete benchmark?