Sunday 2 June 2019

javascript - Best method to select random answer from checkboxes

So I am starting my first ever personal coding project and I decided to create a website that will pick a restaurant nearby from a list randomly.



I am in the process of learning JS at the moment and I was just wondering what would be the best way to go about it.



I will have about 40-50 checkboxes on the website and users will be able to select which restaurants they may want to eat at and then click a button and one will be picked at random.




Is there a way to assign them all to an array and then pick one from the array at random?



Sorry if my question is too broad, I really don't know what specifically I am asking for.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...