News for hackers. Stuff that matters.
Re:You might not need jQuery (2014) by ryanbrunner on Thursday January 14, 2021 @06:21AM (#25775044)
Maybe a nit, but these aren't equivalent. The jQuery version will apply it to all elements that match your selector, where the ES6 version will only apply to the first matching element.

Equivalent code in ES6 would be (maybe there's a terser way but this is what I'd do at first glance):

    [...document.querySelectorAll('.className')].forEach(el => el.classList.add('darktheme'));
Not a whole lot extra in terms of actual code, but I'd argue it's not super intuitive (having to cast a NodeList to an array is a pretty big beginner footgun), and as you get into more complex scenarios, the jQuery architectural pattern of operating against collections of nodes really shines.
Re:You might not need jQuery (2014) by ratww on Thursday January 14, 2021 @06:44AM (#25775230)
You can use forEach without the splat:

    document.querySelectorAll(".className").forEach(el => el.classList.add('newClass'));
Re:You might not need jQuery (2014) by jamiesonbecker on Thursday January 14, 2021 @11:12AM (#25778091)
Still doesn't seem like much of a win compared to the jQuery :)

    $(".classname").addClass("darktheme")
Re:You might not need jQuery (2014) by peanut_worm on Thursday January 14, 2021 @08:37AM (#25776100)
NodeLists should have a forEach method as far as I know