Find value in array

Benchmark created on


Setup

let arr = [
  42,
  3.14,
  "Hello, world!",
  true,
  false,
  null,
  undefined,
  NaN,
  Infinity,
  -Infinity,
  BigInt(1234567890123456789n),
  "Another string",
  256,
  512.768,
  "Yet another string",
  true,
  BigInt(9876543210987654321n),
  null,
  1024,
  2048.4096,
  "More strings",
  false,
  undefined,
  128,
  64.32,
  "String again",
  true,
  null,
  BigInt(1000000000000000000n),
  8192,
  4096.2048,
  "Strings never end",
  false,
  undefined,
  16,
  8.16,
  "Final string",
  true,
  BigInt(1111111111111111111n)
];

Test runner

Ready to run.

Testing in
TestOps/sec
Array.find()
arr.find((x)=> x === 1024)
ready
Array.indexOf()
arr.indexOf(1024)
ready
Array.includes()
arr.includes(1024)
ready
Array.some()
arr.some((x)=> x === 1024)
ready
Array.findIndex()
arr.findIndex((x)=> x === 1024)
ready

Revisions

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