getImages
Fetches all images from within an element and puts them into an array.
- Use
Element.getElementsByTagName()to get all<img>elements inside the provided element. - Use
Array.prototype.map()to map everysrcattribute of each<img>element. - If
includeDuplicatesisfalse, create a newSetto eliminate duplicates and return it after spreading into an array. - Omit the second argument,
includeDuplicates, to discard duplicates by default.