I am detecting whether the mousepointer is within an ellipse that I have drawn in P5.js. When the mouse is in contact with the ellipse it should be deleted. I can achieve this by iterating over the array that stores the ellipses locations, checking if the mouse pointer is close enough to them to be warranted as inside by accessing the width element.w. This is a way to do it with a simple for loop:
for(var i = 0; i < locations.length; i++){
    var d = dist(mouseX, mouseY, locations[i].x, locations[i].y);
    if(d <= locations[i].w){
        locations.splice(i,1);
    }
}
I am wondering what the forEach loop way to do this would be. I premuse it would be something like the below code, but how do you actually destroy the element?    
locations.forEach(function(element) {
    var d = dist(mouseX, mouseY, element.x, element.y);
    if(d <= element.w){
        //Destoy the element??? How do you do that????
    }                   
});