Just a clarifying question for now. The instructions say to:
Declare a const array listing the filenames of each image, such as 'pic1.jpg' .
Declare a const object listing the alternative text for each image.
Loop through the array of filenames, and for each one, insert an <img> element inside the thumb-bar <div> that embeds that image in the page along with its alternative text.
I guess I’m confused on why we should use an array and then an object reiterating the file name key with alt text as a value…
Are we supposed to make two arrays, one as file names and one as alt text since arrays are objects as well?
If we are to use an array for file names and an object for alt text, wouldn’t it be better to use only an object and iterate through the object instead?
The idea for the alt texts is something like this:
const alts = {
'pic1.jpg' : <alt_text>,
...
}
You can then select the correct alt text in the loop with the image name as the object key.
I think the task was designed to test your ability to use dynamic object keys. In a more “real world” example you would probably have one array of objects, each containing a “name” and an “alt” property.