vendredi 17 juin 2022

My array can't find the source of my pictures, how do I fix it? [closed]

So I'm building an comic slider on javascript and I want it to have a "pick a random comic" option. So, naturally, I tried to built a random function over a pretty big array. And made it, but, the function can't find the src of the pictures! What should I do? Everything seems good but maybe I'm missing something... can u help me with my code? thanks!

function random() {    
var randomNum = Math.floor(Math.random() * imgArray.length);
document.getElementById("comicdehoy").src = imgArray[randomNum];
}



Aucun commentaire:

Enregistrer un commentaire