mardi 13 mars 2018

How do I create a function that randomly selects other functions?

So I've created several random generators with HTML/Javascript, and they spit out random words or a combination of randomly generated phrases. I only know how to fill the variable I want to randomize with a list of words or numbers.

But now, I want to know if I can have the button element randomly select from a few different random generator functions I've defined in my document. That way, I can have one set of random combinations or another set of combinations selected with one single button. For example, on click, you either get a female first/middle/last name or a male first/middle/last name, instead of having an individual button for each function.

In other words: how do I create a function that randomly selects other functions?

NOTE: I'm pretty new at at all this.




Aucun commentaire:

Enregistrer un commentaire