+ 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?
2 odpowiedzi
+ 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.
+ 1
https://code.sololearn.com/WSDnL4ts9erp
got it!!!