Need a bit of help


#1

Alright, this has nothing to do with control flow is JS, but, I need some help with one of my own projects. I was wondering is there was a way to perform a code a second time, without having to do it again. For example:

var random = prompt("Ok, where do you want to go?")
switch(random) {
case "hill": 
// monster fighting stuff here  
break;
case "other place": 
// more fighting other stuff here
break;
default;
// random default
}

Then, after the default, I wanted a way for the variable random to run again. Any suggestions?


#2

Loops or functions. What do you specifically mean by do again? Also you can post in the javaScript categorie if you have a general question but in case you do this rather use a meaningful title.