I have the following code generating an image url based on an array of objects and their properties:
for (let s = 0; s < amount; s++) {
console.log(projects[s].imagelocation + projects[s].images[0]);
}
As an example this gives me the following output:
img/EnergyGoStix-assets/GoStix1.jpg
img/Premier-assets/PremierStudios1.jpg
img/Quickstix-assets/QuickStix1.jpg
img/MotherMonster-assets/MotherMonster1.jpg
img/Stepping-assets/SteppingBooklet1.jpg
However, the images property is actually an array. This array contains multiple image sources such as GoStix1.jpg, GoStix2.jpg, etc. This number of image sources varies between the projects.
How do I create a loop within a loop that would incorporate images.length where it will first go through each project and generate all image sources, prior to moving onto the next one?
P.S - Sorry for the terrible post title, had no idea what to call this. If anyone can come up with a better one to help be more precise, please let me know so I can update it.
for (let i = 0; i < projects[s].images; i++)?for (let s = 0; s < amount; s++) { console.log(projects[s].imagelocation + for (let i = 0; i < projects[s].images; i++) { projects[s].images[i]) }; }