We are talking about CSS and Javascript.
I want 10 CSS div's (a yellow square, a green square and a red square...) to appear randomly on the screen after a time period of 1-3sec.
Problem:
- Choosing one out of 10 (or N in general) objects to appear at random: Must I build on the Math.random() method by using if between 0 and 0,1 choose the first object, if between 0,1 and 0,2 choose the second object etc., or is there a more scalable way?
Aucun commentaire:
Enregistrer un commentaire