Ok, just know your definitely going to want to have:
1. a for loop to search for all the images on the page
2. an if statement to find out if the parentNode of the image has a tagName of A (i.e. if the <img> tag has <a> wrapped around it)
3. And then youll want to wrap this all in a function.
Im sure youll figure it out! Good luck