What is the dollar sign in Javascript, if not jQuery

1) Is it correct that dollar sign was not assigned, a few years back, or do I remember wrong?

That’s correct and still true.

2) What is the dollar sign, if not jQuery?

Firefox and Chrome implement $, $$ and several others as helper commands. Both will set $$ to document.querySelectorAll(), and set $ to document.querySelector if window.$ hasn’t been defined.

So what you’re seeing isn’t actually standard JavaScript, but a helper in the developer console of your browser. It’s also not jQuery (as long as you’re not on a page using jQuery). However, it’s behaviour is close to the one of jQuery, concerning that querySelector (for single matches) and querySelectorAll (for multiple matches) give you almost the same strength as the jQuery selector.

Leave a Comment