Hacker News new | ask | show | jobs
by silverlimetea 14 days ago

    querySelectorAll('.quote')
1 comments

querySelector/querySelectorAll() are great for plucking out deeply nested elements but if all you need is to find all elements of a certain class and the API gives you a tool to do exactly that, why not do that instead of reaching for the general-purpose Swiss army knife? Sure, the execution speed difference may be only measurable in microseconds, but it takes about the same amount of time to type so why not use the specific tool?
This is the specific tool. Wrapping it in Array.from is the extra step.

The Array-like already works for forEach and for .. of