removeChild IF

Is there a way I can make something removeChild IF it’s added? Because it might not be added, but I need it to remove it IF it is.