I have several javascript functions and conditions. Each one of the functions can be excecuted only if the conditions are true. It's possible that two functions will meet the conditions and if this happens, I want to randomly choose a function to execute.
for example:
foo will execute only if cond1 is true goo will execute only if cond2 is true hoo will execute only if cond3 is true
lets say that cond1=true, cond 2=false cond3=true. I want to randomly choose between foo and hoo.
What's the best way to implement that?
Aucun commentaire:
Enregistrer un commentaire