I have an HTMLCollection: document.getElementsByClassName('done') and now i want to implement a function addEventListeners.Now i can do it like this:
Object.prototype.addEventListeners = function(argument){ Object.values(this).forEach(function(element, index) { }); }; But i have read in numerous websites that extending native objects is a bad idea.So what are the alternatives?
Array.from(elementList, (el)=> { el.addEventListener(evenName, handler)})HTMLCollectionin this case