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

Writing the todo-list with javascript or jQuery? Best practices

Hello everybody,

I have some questions on "Interactive Web Pages with JavaScript" course

Writing the to-do list app with jQuery or native javascript:

1.Which one is the best practice?

2.Which one is faster?

3.Which one has better browser compatibility?

I know the propose of this course was teaching javascript, but i was curious to know which is the best practice.

Thanks,

Hey Jaber Salehi, Absolutely jquery because it save time,less code and compatible but if you don't have good grip in javascript yet..! then you should write code in pure javascript.When you think yourself compatible with javascript than moved toward jquery.

Patrick Mockridge
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Patrick Mockridge
Full Stack JavaScript Techdegree Graduate 45,611 Points

There is nothing wrong with using JQuery. You will find it's faster and the code is often easier for others to read and understand. Browser compatibility isn't an issue for any modern browsers, although older versions of IE will require you to use the older version of JQuery.

In terms of speed native javascript is a little faster but for most applications this won't make a difference.

Overall widely supported helper libraries like JQuery are perfectly good to use in most situations.

1 Answer

Steven Parker
Steven Parker
231,007 Points

There are "best practices" for working in any particular environment, but the environment itself is purely a matter of choice. If you know JQuery, you're likely to use it because it speeds development, provides additional capabilities, and makes your code more compact. But if you can do everything you want without it, that's fine also.

Speed will nearly always be more about your coding proficiency than the tools used.

And browser compatibility is not really a factor nowadays for either approach.

Happy coding!   -sp:sparkles: