You can wrap that in Array.from() to take advantage of foreach, filter, etc..
const elements = document.querySelectorAll('li');
[...elements].forEach((element) => element.addEventListener('click', this.onClickHandler));Is there a website that stays up-to-date with a brief summary of all this nonsense? I haven't programmed in JavaScript in 4 years but am needing to relearn it again for a project, and searching Google for "iterating over elements" in JavaScript returns 57 different techniques, all considered "the best way" at some different point in time over the last few years, and all with varying levels of browser support.
Looping/filtering over things should just not be this convoluted of a process...
var elements = document.querySelectorAll('li');
var arr_elements = [].slice.call(elements);