title: Find and style multiple strings efficiently
body: <p>I can search and change the styling of all occurrences of a specific string with indexOf(), like so: </p>
  
  <pre><code>var links = [...document.body.getElementsByTagName("a")];
  
  for (var i = 0; i &lt; links.length; i++) {
    if (links[i]["href"].indexOf("dog") == -1) {
      continue;
    }
    links[i].style["color"] = "green";
  }
  </code></pre>
  
  <p>But how would I change all occurrences of multiple given strings, i.e. "dog" AND "cat"? </p>
  
  <p>I wasn't expecting this to work but tried it anyway: </p>
  
  <pre><code>var links = [...document.body.getElementsByTagName("a")];
  var pets = ["dog", "cat"];
  
  for (var i = 0; i &lt; links.length; i++) {
    if (links[i]["href"].indexOf(pets) == -1) {
      continue;
    }
    links[i].style["color"] = "green";
  }
  </code></pre>
  
  <p>It does not work.</p>