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 everysrc
attribute of each<img>
element. - If
includeDuplicates
isfalse
, create a newSet
to eliminate duplicates and return it after spreading into an array. - Omit the second argument,
includeDuplicates
, to discard duplicates by default.