|
|
|
|
|
by jamiesonbecker
1988 days ago
|
|
Somewhat true, but this was also old jQuery :) Even the old jQuery seems easier to read than the modern ES6 equivalent (IMO). jQuery: $(".classname").addClass("darktheme")
ES6: document.querySelector(".classname").classList.add("darktheme")
|
|
Equivalent code in ES6 would be (maybe there's a terser way but this is what I'd do at first glance):
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.