Is alphabetical - includes vs regex.

Benchmark created on


Setup

const letters = 'abcdefghijklmnopqrstuvwxyz'.split('');
const aToZ = [...letters, ...letters.map((char) => char.toUpperCase())];

const random = (arr) => arr[Math.floor(Math.random()*arr.length)];

Test runner

Ready to run.

Testing in
TestOps/sec
Regex
/[a-zA-Z]/.exec(random(aToZ));
ready
Includes
aToZ.includes(random(aToZ));
ready

Revisions

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