document.querySelectorAll returns a NodeList element which is not a plain array, so you normally can't use the map function on it, and have to use it this way: Array.prototype.map.call(document.querySelectorAll(...), node => { ... }). The above code using the :: will work because it is equivalent to: