I am needing to use javascript to show a prompt, and when the user enters a number from 1-12 (1 for each month of the year) it adds it to a new array. Then when the user types "stop" it prints the corresponding months.

I'm new to javascript so I am not quite sure how to go about doing it. This is what I have currently, but I don't think it is right.

Code:

<script type="text/javascript">
var month=['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var selmonth= new Array();
var month2=prompt('Which Month', '');
if (month2==1){
selmonth[0] = month[1];
var month2=prompt('Which Month', '');
}
if (month2==2){
selmonth[1] = month[2];
var month2=prompt('Which Month', '');
}
if (month2==3){
selmonth[2] = month[3];
var month2=prompt('Which Month', '');
}
if (month2==4){
selmonth[3] = month[4];
var month2=prompt('Which Month', '');
}
if (month2==5){
selmonth[4] = month[5];
var month2=prompt('Which Month', '');
}
if (month2==6){
selmonth[5] = month[6];
var month2=prompt('Which Month', '');
}
if (month2==7){
selmonth[6] = month[7];
var month2=prompt('Which Month', '');
}
if (month2==8){
selmonth[7] = month[8];
var month2=prompt('Which Month', '');
}
if (month2==9){
selmonth[8] = month[9];
var month2=prompt('Which Month', '');
}
if (month2==10){
selmonth[9] = month[10];
var month2=prompt('Which Month', '');
}
if (month2==11){
selmonth[10] = month[11];
var month2=prompt('Which Month', '');
}
if (month2==12){
selmonth[11] = month[12];
var month2=prompt('Which Month', '');
}
if (month2=='stop'){
document.write(selmonth.join(" <br> "));
}
else{
alert('Please enter a valid value');
}
</script>

It'd be great if someone is able to help me.

Thanks.