Test if a specific value in an object containing a specific value in an array is truthy

Benchmark created on


Setup

const arr = [
  { foo: 1, bar: true },
  { foo: 2, bar: false },
  { foo: 3, bar: true }
]

Test runner

Ready to run.

Testing in
TestOps/sec
find()
arr.find(item => item.foo === 2).bar === true
ready
findIndex()
arr[arr.findIndex(item => item.foo === 2)].bar === true
ready
some()
arr.some(item => item.foo === 2 && item.bar === true)
ready

Revisions

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