javascript - How can I determine the birth month of a pregnant woman if i know the month she took in? -


i have tried below code out success:

function pregnancy(){  	var letknow =prompt("what month did take in?");  	var find = new date;  	var allocate= new array();  	month[0] = "january";  	month[1] = "february";  	month[2] = "march";  	month[3] = "april";  	month[4] = "may";  	month[5] = "june";  	month[6] = "july";  	month[7] = "august";  	month[8] = "september";  	month[9] = "october";  	month[10] = "november";  	month[11] = "december";  	var discover= allocate[find.getmonth()];  	var capsensitive = letknow.tolowercase();  	var birthequation = discover - capsensitive;  	alert("congratulations, put birth in " + birthequation);  }  pregnancy();

please nothing seems work anytime try run it

i think best way.

<script>   function puttobirth(month) {     return month == 3 ? 12 : (month + 9) % 12;   }    var letknow = -infinity;    while (isnan(letknow) || letknow < 1 || letknow > 12 )     letknow = prompt("what month did take in? (1 12)");    alert("congratulations, put birth in month #" + puttobirth(number(letknow))); </script> 

Comments