Array.includes vs OR statement

Benchmark publishedon

Setup

const status = 401;

Test Runner

Initializing...

Testing in
Test CaseOps/sec
Array.includes
if ([401, 403, 404].includes(status)) {
  void 0;
}
ready
OR Statement
if (
  status === 401 ||
  status === 403 ||
  status === 404
) {
  void 0;
}
ready

Revisions

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

Revision 1
publishedon
Revision 6
publishedon