I had a question about loading images into an array in JS and then appending them to various places to your website.
Let's say I have a folder with 3 images that I'd like to load into an array and then place in this setting
<body>
<div id = "mainImage1"></div>
<div id = "mainImage2"></div>
<div id = "mainImage3"></div>
</body>
Is it possible to load the images, first into a general array, and then put those images within their divs?
Kind of like this? (This code is incorrect)
var mainImage1 = document.getElementById("mainImage1");
var mainImage2 = document.getElementById("mainImage2");
var mainImage3 = document.getElementById("mainImage3");
var mainImageSelection = new Image();
mainImageSelection.src = "Images/" + mainImageSelection[i];
mainImage1.appendChild(mainImageSelection[0]);
mainImage2.appendChild(mainImageSelection[1]);
imageNameanddivName?document.createElement('img');