Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Object-Oriented JavaScript: Challenge Making the Game Interactive drop() Method Animation Challenge Solution

Patrick Eaton
Patrick Eaton
3,860 Points

What does $() signify?

I believe this is the first time in this course that I've seen the $(this.htmlToken) notation. What does the $() signify here?

This is a method used commonly in jQuery, but as far as I know it's not native to vanilla JavaScript. My guess is this course was recorded back when using jQuery was more common. The latest release of JavaScript, ES6, has kind of made jQuery obsolete so it's not as common to see it anymore.

2 Answers

Patrick Eaton
Patrick Eaton
3,860 Points

I see. Thank you, Bert Witzel! Not only did you answer my question, but you also clued me in to the fact that jQuery is not so much of a thing anymore. I was thinking I would need to learn that next, but perhaps I would be better off learning more about the latest JavaScript advancements!

Courtney Wilson
Courtney Wilson
8,031 Points

Just an FYI, it may not be common to use in newer projects but some places still use it due to outdated code/codebase and not willing or able to update. I had to learn it on the fly because it was used heavily in one of my projects at work.

Patrick Eaton
Patrick Eaton
3,860 Points

Thank you, Courtney.

Now that I know this comes from jQuery, I looked up the relevant documentation:

... jQuery() — which can also be written as $() — searches through the DOM for any elements that match the provided selector and creates a new jQuery object that references these elements...