Exactly, and let me add this from my experience maintaining large front-end projects: using $
as a naming convention really helps distinguish between jQuery and plain JS. Imagine debugging a script and trying to figure out whether you can use .val()
or value
on an object—that’s where this tiny character saves hours.
var $item = $(this).parent().parent().find('input');
In this example, $item
clearly tells me it’s a jQuery object, so I can safely call $item.val()
without second-guessing. While the significance of the dollar sign in JavaScript variable names isn’t enforced by the language, the convention is a soft rule in many codebases. It’s not just about syntax—it’s about making your code easier to read, especially when you’re switching between different paradigms or libraries.