DEV Community

Discussion on: Use $ & $$ Instead of document.querySelector/All in JavaScript without jQuery

Collapse
 
maxart2501 profile image
Massimo Artizzu

Watch out that querySelectorAll returns a NodeList object, whereas $$ in the console returns an array.

So if you're used to call all the sweet array prototype methods, you might fall short!

Solution: wrap everything in Array.from.

Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️

Thanks for reminding us :)