Checking for element in set or array

Benchmark created on


Setup

const status = 'trialing';
const array  = ['active', 'trialing'];
const set  = new Set(['active', 'trialing']);

Test runner

Ready to run.

Testing in
TestOps/sec
array (predefined)
array.includes(status)
ready
set (predefined)
set.has(status)
ready
array (instantiated)
['active', 'trialing'].includes(status)
ready
set (instantiated)
new Set(['active', 'trialing']).has(status)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.