How can I *loop* the following code? ..[]
In this code I have multiple images[] and the images have their own names[] that will be displayed when the image is clicked. For example you can click on the sunset image and the profile image changes to the sunset image. And the name of the profile image displays under the profile. Same thing for the other images. The code is already functional to where you can click on an image and the name and profile image changes, but I need to loop the code that's at the bottom of the JS. I need help looping the part that has the onClick events. In the end, the code should function just like it is now, but the Js code will be shorter. I want to loop it because I don't want to keep doing what I'm doing right now for another 100 images. Thank You. https://code.sololearn.com/WugC4ZSZCudF/#js