on{eventName} attribute, where eventName represents the name of event.
For example:ele.onclick = function() {...};// Remove the event handlerdelete ele.onclick;
onclick attribute, for example, will override any existing handler for the click event.const handler = function() {...};// Attach handler to the `click` eventele.addEventListener('click', handler);// Detach the handler from the `click` eventele.removeEventListener('click', handler);
addEventListener and removeEventListener methods.
It differs from the first approach which requires to prefix the event name with on.