In this activity, you will take a list of image IDs listed in picsum-list.js and create a gallery of images using the Lorem Picsum service.
Lorem Picsum is an image service that allows you to embed placeholder photos into your web pages. The images are pulled from open-source Unsplash images.
For example, the following HTML displays this puppy image
<img src="https://picsum.photos/id/237/300/300" alt="Lorem Picsum Image">-
Create empty
outputvariable that will contain the gallery images string. -
Create a function
handleItem()that accepts the arrayitem(the Picsum image id) as a parameter. -
In this new function, take the Picsum image id and create a valid img element that's 300px x 300px
<img src="https://picsum.photos/id/[imageId]/300/300" alt="Lorem Picsum Image">
-
Using
Array.forEach(): loop through each Picsum image id, invokinghandleItem()for eachimageId. -
Using
.innerHTMLand the addition assignment operator (+=) (or another method of your choice), output the image to the<section>element inindex.htmlso that a gallery of all images is displayed on the page.
See a potential answer to this activity.