Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
Chrome 75
Windows
Desktop
5 years ago
Test name Executions per second
Includes 5037679.0 Ops/sec
Match 3604696.8 Ops/sec
IndexOf 5219480.5 Ops/sec
Script Preparation code:
x
 
string1 = "something is not right but we can make it longer < and > also more stuff < try to make it <br>"
Tests:
  • Includes

     
    if (!string1.includes("<br>") && !string1.includes("/>")) {
        console.log("something else");
    }
  • Match

     
    if (!string1.match(/(\/>|<br>)/)){
        console.log("something else");
    }
  • IndexOf

     
    if (string1.indexOf("<br>") === -1 && string1.indexOf("/>") === -1) {
        console.log("something else");
    }