There is a similar question concerning this problem in C++, but I'm using JavaScript here. I'm basically in the same situation as the OP in the other post.
var input = prompt();
while(true) {
switch(input) {
case 'hi':
break;
case 'bye':
//I want to break out of the switch and the loop here
break;
}
/*Other code*/
}
Is there anyway to do that?
I also have multiple switches in the /*Other code*/
section where the code should also break.