Hi! i am a bigginer and having problem in switch case plz help

let month = prompt ("enter your month?")
month=Number.parseInt(month)
switch("month"){
  case 1:
    console.log("january")
    break;
    case 2:
    console.log("feb")
    break;
  case 3:
    console.log("march")
    break;
  case 4:
    console.log("april")
    break;
  case 5:
    console.log("may")
    break;
  case 6:
    console.log("june")
    break;
  case 7 :
    console.log("July")
    break;
  default:
    console.log("invalid entry")
   
}

why this is not working?

Please format your code.
As for error you need switch(month), as now you have put a string there and not the variable month

1 Like

Thank you so much.
greetings for the day .

1 Like