Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Variable in array vs check variables individually
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
Browser:
Firefox 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Variable in array
67682136.0 Ops/sec
Variables indidually
973580864.0 Ops/sec
Script Preparation code:
var myNumber = 5;
Tests:
Variable in array
const result = [0,1,2,3,4,5].includes(myNumber);
Variables indidually
const result = myNumber === 0 || myNumber === 1 || myNumber === 2 || myNumber === 3 || myNumber === 4 || myNumber === 5;