Yeah, thats a common criticism of ES6 selector I see a lot.
They are so damn verbose.
They are so damn verbose.
[...document.querySelectorAll('.example')]
Typically I see people create a utility function $ (querySelector) and $$ (querySelectorAll with conversion to array).But this is fairly typical of the DOM API, some parts are awkwardly designed.
document.querySelectorAll('.element').forEach(i => { yourFunction(i); });
I've not used map a whole lot, but I'm positive that it would work as well.
https://developer.mozilla.org/en-US/docs/Web/API/NodeList/fo...
entries()
forEach()
item()
keys()
values()
And maybe values().map() will work too.