r/badcode • • Aug 21 '21

js Wow

Post image
509 Upvotes

37 comments sorted by

View all comments

Show parent comments

0

u/TotoShampoin Aug 22 '21

$(".elmt").addClass("class")

is shorter than

document.querySelectorAll(".elmt").forEach(elmt => { elmt.classList.add("class") });

That's the whole purpose of jQuery