title: Javascript code required for refering a JS file depends on the environment Prod, Dev, stage
body: <p>I want to check Prod, dev and QA URL based on the URL i need to refer a .js file</p>
  
  <p>Production URL: domain.com and www.domain.com</p>
  
  <p>i should refer: src=prod.js file if the URL is production url</p>
  
  <p>Dev and QA URLs: dev.domain.com and staging.com</p>
  
  <p>i should refer: src= staging.js file if the URL is dev or QA or both,</p>
  
  <p>I wish to use this window.location.href.search using if else condition.</p>
  
  <p>Please help me with the if else condition using javascript.</p>
  
  <hr>
  
  <p>I tried the with the below code but it is not working</p>
  
  <pre><code>if (window.location.href.search("domaing.com")!=-1 &amp;&amp; window.location.href.search("staging.vicodin.com"|"dev.domain.com)==-1) { 
          src=prod.js
  } 
  else{
  src=staging.js
  }
  </code></pre>
  
  <p>Please help me to have the correct code</p>