Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
kabir kCourses Plus Student 18,036 Points
Also, under what circumstances should one use one over the other?
Erik Krieg43,037 Points
Hi Kabir! Here is a quick comparison:
The downside of vanilla JS is that it is easier to make mistakes or miss something, is less beginner friendly (than jQuery), and can require you to develop more code to accomplish goals the would take much less time with jQuery.
The primary benefit of jQuery is the reduced development time it offers web devs and its easy to use API and numerous plugins. Also, when you use jQuery you are still writing some vanilla JS, so it is not truly one or the other.
The downside is that by adding it to your project you might bloat the resources you need to load, call unnecessarily verbose methods, and avoid learning how the language actually works.
How to choose
jQuery is a fine choice in the following situations:
- For small projects where perfomance is not a big issue
- Simple projects with a tight deadline
- Large projects that use an MVC library or framework that has jQuery as a dependency
Now, times you might not need jQuery include:
- Acquiring an intermediate - advanced understanding of JS
- Working on complex web applications
- Building you own library or framework
- Server side applications with Node.js
Here is some more on the topic.