Determine if all

Benchmark created on


Setup

const contacts = Array(600).fill(null).map((_, index) => ({ id: index, firstName: 'John', lastName: 'Doe', job: 'Frontend Dev', status: 'completed' }));

Test runner

Ready to run.

Testing in
TestOps/sec
every
const hasEnded = (contacts) =>
  contacts.every(({status}) => status === 'completed');
  
hasEnded(contacts)
ready
some
const hasEnded = (contacts) =>
  contacts.some(({status}) => status !== 'completed');
  
hasEnded(contacts)
ready
findIndex
const hasEnded = (contacts) => contacts.findIndex(({status}) => status !== 'completed') === -1;
  
hasEnded(contacts)
ready

Revisions

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