title: Javascript else if statement stops executing unexpectedly
body: <p>This is my first question to the community here so please forgive any shortcomings with respect to best practices.</p>
  <p>I have a JavaScript else if statement which stops executing immediately after the following snippet of the else if statement:</p>
  <pre><code>} else if (email != '') {
      if (validateEmail(email)) {
          email = email.toLowerCase();
      }
  }
  </code></pre>
  <p>I have tried removing the nested if statement completely and logging a message to the console to make sure that when the condition of the else if statement is being met I can very in the console. For example, the output to the console in this case is &quot;email has a value&quot;</p>
  <pre><code>} else if (email != '') {
          console.log('email has a value');
      }
  </code></pre>
  <p>After that the else if statement seems to stop executing. I'm really hung up here and any guidance is greatly appreciated - thank you in advance.</p>
  <p>Following is the comprehensive set of pertinent code if that is helpful to provide some context:</p>
  <pre><code>function applyFocus(target, message) {
      alert(message);
      document.getElementById(target).focus();
  }
  
  function validateEmail(mail) {
      var mailLower = mail.toLowerCase();
      if (/^(([^&lt;&gt;()\[\]\\.,;:\s@&quot;]+(\.[^&lt;&gt;()\[\]\\.,;:\s@&quot;]+)*)|(&quot;.+&quot;))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(mailLower)) {
          console.log('returning true');
          return true;
      } else {
          errorMessage = 'Please enter a valid email address.';
          applyFocus('email', errorMessage);
          console.log('returning false');
          return false;
      }
  
  if (firstName == '') {
      // do something
   } else if (lastName == '') {
      // do something
   } else if (email == '') {
      // do something
   } else if (email != '') {
      if (validateEmail(email)) {
          email = email.toLowerCase();
      }
   } else if (industry == '') {
      // do something
   } else {
       // do something
   }
  </code></pre>