const imgs = document.querySelectorAll(".imgs"); setInterval(() => { let randomNumb = Math.floor(Math.random() * 3); const images = ["img1.jpg", "img2.jpg", "img3.jpg"]; imgs.forEach((img) => { img.src = images[randomNumb]; }); }, 3000);
how can i alter this code so that i can display 3 different set of images for my 3 image containers. i mean i can repeat the code 3 times and make different arrays for all 3 instances but is there an easier or shorter way of doing it?