the variable room_x_beds necessary, not bothered default area.
i can not assign value of var room_x_beds var x ?
i not understand why.
code:
var room_1_beds = 2; var room_2_beds = 2; var room_3_beds = 1; var give_num = prompt(); var x; switch(give_num){ case "1": x = room_1_beds; break; case "2": x = room_2_beds; break; case "3": x = room_3_beds; break; default: break; } switch(x){ case "1": console.log ("text"); break; case "2": console.log ("text"); break; default: break; }
the values of second switch
statement should numbers not strings.
var room_1_beds = 2; var room_2_beds = 2; var room_3_beds = 1; var give_num = prompt(); var x; switch(give_num){ case "1": x = room_1_beds; break; case "2": x = room_2_beds; break; case "3": x = room_3_beds; break; default: break; } switch(x){ case 1: console.log ("text"); break; case 2: console.log ("text"); break; default: break; }
Comments
Post a Comment