title: Javascript window.location.href.indexOf is A and not B
body: <p>I'm using the following to do somting when url contains gender=men&amp;dir=  </p>
  
  <pre><code>if(window.location.href.indexOf("gender=men&amp;dir=") &gt; -1) {
  
        }
  </code></pre>
  
  <p>Now i need to say url contains gender=men&amp;dir=  and not &amp;dir=Schoenen do something </p>
  
  <p>i was trying this only its not working </p>
  
  <pre><code>if(window.location.href.indexOf("gender=men&amp;dir=" || !"&amp;dir=Schoenen") &gt; -1) {
  
        }
  </code></pre>