title: JavaScript executing code after a false return
body: <p>I am using a function to check if required fields are filled. I have these two functions, that should do the same, however the first one does not. Shouldn't javascript stop executing code, after it meets a return?</p>
  
  <p>This functions returns true:</p>
  
  <pre><code>//Checks if various stages are ready
  function trnReady(area) {
      switch (area)
      {
          case 'settings':
              $('input.required').each(function(){
  
                  if($(this).val() == '')
                  {
                      return false;
                  }
              }); 
          break;
      }
      return true;
  }
  </code></pre>
  
  <p>While this one returns false:</p>
  
  <pre><code>//Checks if various stages are ready
  function trnReady(area) {
      var r = true;
      switch (area)
      {
          case 'settings':
              $('input.required').each(function(){
  
                  if($(this).val() == '')
                  {
                      r = false;
                  }
              }); 
          break;
      }
      return r;
  }
  </code></pre>
  
  <p>I thought the first return would stop executing code? I'm wondering if it has anything to do with scope?</p>