title: Is there a better way to 'do nothing' in javascript if statement?
body: <p>My url looks like this = <code>https://studentscafe.com/menu/2</code></p>
  
  <p>I'm trying to check whether or not it has 2 different url params...</p>
  
  <p>1.) <code>?dinner=1</code></p>
  
  <p>or </p>
  
  <p>2.) <code>&amp;dinner=1</code></p>
  
  <p>If #1 is present, do nothing</p>
  
  <p>If #2 is present, do nothing</p>
  
  <p>But if neither are present, default to adding <code>?dinner=1</code> to the url.</p>
  
  <p>Is there a better way to have a  default do nothing in an if statement? <a href="http://jsfiddle.net/jQu3L/56/" rel="nofollow noreferrer">Fiddle here</a> for example.</p>
  
  <pre><code>var path = 'https://studentscafe.com/menu/2';
  
  if (path.indexOf('?dinner=1') &gt;= 1) {
      console.log('has ?');
      // do nothing leave url as it is
  
  } else {
      console.log('does not have ?');
      if (path.indexOf('&amp;dinner=1') &gt;= 1) {
          // do nothing leave url as it is
      } else {
          path = path + '?dinner=1';
      }
  }
  </code></pre>
  
  <p>Expected output: if the url doesn't have #1 or #2: <code>https://studentscafe.com/menu/2?dinner=1</code></p>