title: Switch return value is undefined
body: <p>When I run this code from Notepad++ through an .html file, the output doesn't recognize my return values. It always outputs "undefined"</p>
  
  <p>I've tried putting the return statement outside of the switch statement but it didn't solve anything.</p>
  
  <p>Edit: I included the code that calls the function and I fixed my if statements based on iCode's tips.</p>
  
  <pre><code>// this came with the execrise
  var sentinel = true
  
  while (sentinel) {
  
      var month = prompt("Enter an integer from 1 to 12 inclusive, representing a month of the year");
      var request = prompt("Enter 1 if you want the name of the month, or enter 2 if you want the number of days in the month");
  
      if (months(month,request) == false) {
          // reset
          alert("Try again but enter the right stuff this time");
  
      } else {
          // output
          sentinel = false;
  
          if (request == 1) {
  
              console.log("Month number " + month + " is " + months(month,request));
  
          } else if (request == 2) {
  
              console.log("There are " + months(month,request) + " days in month number " + month);
          }
      }
  }
  
  // this is my edited code
  function months(month,request) {
      if (!request || request &lt; 1 || request &gt; 2 || isNaN(request)) {
          return false;
      }
      if (!month || month &lt; 1 || month &gt; 12 || isNaN(month)) {
          return false;
      }
  
      var name;
      var numberDays;
      switch(month){
          case 1:
              if(request == 1){
                  name = "January";
                  return name;
              }else{
                  numberDays = "31";
                  return numberDays;
              }
              break;
  
          case 2:
              if(request == 1){
                  name = "February";
                  return name;
              }else{
                  numberDays = "28";
                  return numberDays;
              }
              break;
  
          case 3:
              if(request == 1){
                  name = "March";
                  return name;
              }else{
                  numberDays = "31";
                  return numberDays;
              }
              break;
  
          case 4:
              if(request == 1){
                  name = "April";
                  return name;
              }else{
                  numberDays = "30";
                  return numberDays;
              }
              break;
  
          case 5:
              if(request == 1){
                  name = "May";
                  return name;
              }else{
                  numberDays = "31";
                  return numberDays;
              }
              break;
  
          case 6:
              if(request == 1){
                  name = "June";
                  return name;
              }else{
                  numberDays = "30";
                  return numberDays;
              }
              break;
  
          case 7:
              if(request == 1){
                  name = "July";
                  return name;
              }else{
                  numberDays = "31";
                  return numberDays;
              }
              break;
  
          case 8:
              if(request == 1){
                  name = "August";
                  return name;
              }else{
                  numberDays = "31";
                  return numberDays;
              }
              break;
  
          case 9:
              if(request == 1){
                  name = "September";
                  return name;
              }else{
                  numberDays = "30";
                  return numberDays;
              }
              break;
  
          case 10:
              if(request == 1){
                  name = "October";
                  return name;
              }else{
                  numberDays = "31";
                  return numberDays;
              }
              break;
  
          case 11:
              if(request == 1){
                  name = "November";
                  return name;
              }else{
                  numberDays = "30";
                  return numberDays;
              }
              break;
  
          case 12:
              if(request == 1){
                  name = "December";
                  return name;
              }else{
                  numberDays = "31";
                  return numberDays;
              }
      }
  }
  
                  return false;
                      }
                  }else{
                      return false;
                  }
              }else{
                  return false;
              }
          }else{
              return false;
          }
      }
  </code></pre>
  
  <p>I expect the output to be either "Month number 1 is January" or "There are 31 days in month number 1"</p>