The following script uses a switch statement to determine the numeric month based on the actual month. Is there a more succinct way (read: elegant, or less time to write) to accomplish the same result? Is there a down-side or up-side to either approach?
var month = "May";
var m;
switch(month) {
case "January":
m = 0;
break;
case "February":
m = 1;
break;
case "March":
m = 2;
break;
case "April":
m = 3;
break;
case "May":
m = 4;
break;
case "June":
m = 5;
break;
case "July":
m = 6;
break;
case "August":
m = 7;
break;
case "September":
m = 8;
break;
case "October":
m = 9;
break;
case "November":
m = 10;
break;
case "December":
m = 11;
break;
default:
//
}
console.log(m);