My code:
var host_choice = function(){
var choice;
do {
choice = shuffled_list[random_choice()];
} while (choice == "car" || choice == player_choice);
return choice;
};
Here host_choice
is a function which I would have to call. But I am unsure how to make it a variable containing choice
. I know I am missing something basic here, but how to do it?
Side note: my shuffled_list
contains 3 elements. And I want my host_choice
variable to contain neither the element car
nor the player_choice
is there a "fancier" way of doing this?