js choice function 1

js choice function

>>> import random
>>> random.choice(['red','green','blue'])

Here is what the above code is Doing:
1. We import the random module.
2. We call the choice() function from the random module.
3. We pass the choice() function a list of strings.
4. The choice() function returns a random string from the list.

Similar Posts