document.body.addEventListener('click', function check(e) {
if (e.target.matches('.remove-btn')) {
e.target.removeEventListener('click', check);
}
});
The code attempts to remove an event listener from a child element (.remove-btn) that doesn't actually have the listener - the listener is on document.body using event delegation. When using event delegation, you don't need (and can't) remove listeners from the target elements because they don't have any listeners attached. If you need to stop handling events for specific elements, use a flag or remove the elements themselves.