title: How to shorten my nested if/else statement?
body: <p>I have the following js code:</p>
  
  <pre><code>var currentUrl = location
  if(/s01/.test(currentUrl)||/s02/.test(currentUrl)){
      $('#info,#name').removeClass('onselect').addClass('offselect');
      if(/s01/.test(currentUrl)){
          $('#AA').removeClass('offselect').addClass('onselect');
      } else if(/s02/.test(currentUrl)){
          $('#BB').removeClass('offselect').addClass('onselect');
      }
  } else {
      .....
  } 
  </code></pre>
  
  <p>The code has the same part in nested if/else statements:</p>
  
  <pre><code>if(/s01/.test(currentUrl) {
  
  } else if(/s02/.test(currentUrl) {
  
  }
  </code></pre>
  
  <p>Can I shorten it to something like:</p>
  
  <pre><code>if(a){
  
  } else if(b){
  
  }
  </code></pre>
  
  <p>Or any other suggestions?</p>