r/learnjavascript • • Oct 01 '21

jQuery, the greatest JavaScript library of all time, appears to have peaked in usage.

Post image
275 Upvotes

81 comments sorted by

View all comments

Show parent comments

20

u/xRockTripodx Oct 02 '21

Jquery has largely been replaced by ES6. I actively go out of my way to avoid jQuery whenever I can. We don't even use it in our WP starter theme anymore, outside of Bootstrap 4's requirement for it.

-6

u/Negative12DollarBill Oct 02 '21

How could jQuery be replaced by ES6? That's like saying a semi-trailer was replaced by a power station, they're not even in the same category.

10

u/corporaljustice Oct 02 '21

Because with new ES6+ methods you can do many things simply in vanilla JS that previously required jQuery if you didn’t want to write a lot of verbose lines.

Using vanilla JS before document.querySelectorAll() came about without JQ was a pain.

$() is very similar to querySelectorAll().

3

u/Nerwesta Oct 02 '21

In fact, querySelector is an idea taken from jQuery if I'm not mistaken. Same energy for ajax before Fetch API, which to put it simply was a pain to do with vanilla JS at those times. Ajax jQuery was a breeze.

2

u/0xnoob Oct 02 '21

Neither querySelector nor fetch are part of ES6.

querySelector was available in Browsers since around 2009. While fetch was available around the same time as ES6 in 2015, it still isn't part of it.