P5 provides an intuitive ways to interact with the canvas and the web page. Interacting with the mouse click, the location data of the mouse is extracted. When you try double clicking, the flow changes using the logic inside the script running on this page.
Learning to program objects or classes will allow you to see the elements themselves as Objects that have associated functionalities that can be invoked by calling them. To such very useful group of functionalities are that structures the elements and another group adds behavior.
Buttons above get the images or any other DOM element into the html page and has the callback function that can remove them from the page. Each time the Create Picture is pressed, you will 10 random pictures populating below somewhere. This happens how many times you press. Follow that with remove Pics will conveniently delete all the images, without a trace. SelectAll() methhod was used for this functionality.