Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:137.0) Gecko/20100101 Firefox/137.0
Firefox 137
Mac OS X 10.15
Desktop
one month ago
Test name Executions per second
RegEx.test 54759412.0 Ops/sec
Array.includes 65013564.0 Ops/sec
Script Preparation code:
AخA
 
var appState = "active";
var regex = /inactive|background|other/;
var arr = ['inactive', 'background', 'other'];
Tests:
  • RegEx.test

     
    regex.test(appState);
  • Array.includes

     
    arr.includes(appState);