.filter() is not a method on the NodeList though, it only has forEach(), and even that is quite recent.
This is why people convert it to an array, and one of many reasons the standard JS API (and the DOM one in particular) are annoying to work with.
This is why people convert it to an array, and one of many reasons the standard JS API (and the DOM one in particular) are annoying to work with.
[...document.querySelectorAll(selector)].filter(filterFn);If anything isn't that code _less_ idiomatic in that it's less specific to JS and more of a generic operation?
If you've seen that more common than call/apply for years then you probably work almost exclusively on new projects, with people that convert things to bleeding-edge, or with heavy transpilation: The spread operator as used there has only existed in regular released browsers/node for 3-4 years. I don't think it's a stretch to say the vast majority of code out there at this time won't be doing it that way.
Definitely colours my work, and knowledge base.