+ 1

I need help to better this code please (Javascript)

https://code.sololearn.com/WLtJq2OZtB1Q I am trying to create an object constructor function that will place thousands of "I love you's" across the screen in random locations. I have the constructor set up, but I am not sure how to utilize it to create thousands of separate objects without copying and pasting code. Can someone please give me a solution?

16th Jan 2019, 1:39 AM
Phillip Mark England
Phillip Mark England - avatar
2 Respuestas
+ 3
Try var objs =[]; for(var i=0;i<1000;i++) { objs[i] = new newDiv(); objs[i].update(); } And you should use position fixed, instead of absolute.
16th Jan 2019, 2:14 AM
Calviղ
Calviղ - avatar
16th Jan 2019, 1:45 AM
Phillip Mark England
Phillip Mark England - avatar