So I just learned that it makes a difference whether I use
document.querySelectorAll('selector')
or
document.getElementsByClassName('selector')
The latter cant be iterated over with .forEach. This is probably because the latter returns an array-like object, while the first one returns a nodelist.
Now I read that some browsers return an array-like object when using document.querySelectorAll('selector') https://www.w3schools.com/js/js_htmldom_nodelist.asp
I'm not even sure if this problem applies to me, since I'm using a webpack based framework which uses Babel7 to transpile my Code to ES2015. But I would like to make sure that my code works on as many browsers as possible, and therefore it would be nice to know if there is a JS method to retrieve elements from the DOM which makes sure of that.
And on a sidenote, could someone point me to the piece of documentation explaining lists in JS? I couldnt find much, only the doc about arrays. Is a list just an alias for an array in JS?