Want to learn JavaScript js and jquery which important first learn which _ basic knowledge

Source: Internet
Author: User

The author of their own learning and use of experience to share with you, have any questions or doubts, welcome message

Before answering the question, first you need to understand what is JS, what is jquery

JS, or JavaScript
In 1995, Brendan Eich, of Netscape, was first designed and implemented in the Netscape Navigator browser. Because Netscape works with Sun, Netscape Management wants it to look like Java, so it's named JavaScript
JavaScript is a literal translation script language, a dynamic type, a weak type, a prototype based language, and a built-in support type.

Jquery

jquery is a browser-compatible JavaScript library with the core idea of write Less,do more (less written and more)

Through the above brief introduction, presumably everybody already knew the most important point, namely: jquery is a JavaScript library;
So without the author stressed that we should all know JS and jquery which is more important, first to learn which
In fact, as long as you learn JavaScript, using jquery will not be a problem
According to the author's experience, novice programmers must spend time focusing on learning JavaScript;
As for jquery, you can refer to the jquery reference document directly when you use it, without spending too much time on it, and of course, if the reader has enough time, you can learn the jquery source, and better understand the jquery implementation principle.

Small series of cloud-dwelling communities:

Want to learn JS (JavaScript), you must learn the native JS code, so as to understand the essence of JS. And jquery is the library of JS, but in practical applications if a large number of use JS recommended jquery, compared to jquery has a good compatibility of multiple browsers, save a lot of trouble. No need to consider compatibility. If only jquery and not JS are not good for other programming languages to learn.

There is little comparability between JavaScript and jquery.

Although jquery is based on JavaScript, jquery is actually a completely different language from JavaScript, and jquery is actually a combination of a logical language and a purely functional language. Because of these two features, jquery is extremely simplified for DOM operations. jquery often uses one or two lines of code to implement the functionality that JavaScript native code dozens of or even hundreds of lines of code can achieve.

But jquery is a special framework that is not a complete solution and still needs JavaScript.

If you want a sencha that basically doesn't depend on native JavaScript, you can try it.

All kinds of seals, including JQ, Dojo and so on, the main purpose is to worry, take JQ to say:
JQ for different browser events, DOM objects, are encapsulated, all kinds of operations can be directly compatible with a variety of browsers, you know, the difference between browsers is not only in the CSS to write "-webkit-" or "filter" the difference, even the event model of this low-level things are not the same = =
JQ unique Css-like selector, chain style, encapsulated various animate functions, encapsulated asynchronous loading, have greatly improved the development efficiency, reduce duplication of labor
JQ uses delay and a series of functions to encapsulate AJAX operations, which are constantly being visually improved and refined. Anyway is more than JS worry is.
The other is some common functions jq have so do not write yourself, you like browser detection ...
Plug-ins are constantly rich, rich information and so on
Of course, this also leads to the
JQ is 10 times times slower than native JS (Chrome) ~100 times (IE). The specific number forgot, anyway is this order of magnitude ... In particular, some people like to abuse selectors and do not use chain style
So, if only with a single JS can solve the problem, do not use JQ Ah pro ... Pro-Test $ (' #x ') is 40 times times slower than getElementById (' x ')
This is brother @toobug's actual code http://fiddle.jshell.net/toobug/mZPXq/
JQ is not necessarily applicable to all cases, the site is larger will highlight the jq of the deficiencies. For example, there is no namespace--. Many websites build their own library of functions according to their own situation.
On the other side, if the project is more "one app" than "one Web page", JQ is not the most suited

Performance generally depends on your business complexity, development capabilities, team size, can not be generalized
1. High complexity of the project or website, the development capacity is not very strong team, using the original JS will not have the opportunity to allow you to consider performance, compatibility is a great obstacle;
2. The complexity of the business is low, on the Hello World function, does not matter performance;
3. If the team fork, the business complex, code maintainability is the most important, performance tuning will only be in the real time when rendering bottlenecks;
4. Performance still have to look forward, know why office success, because they have been looking forward, the computer processing capacity is more and more strong, what the problem is not a problem.

1, JQ and other frameworks to address usability and compatibility issues, a little less efficient
2, the original JS to solve the problem of operational efficiency, compatibility is more troublesome
3, the advantage of JQ is to allow programmers to live for several years, native JS can allow programmers to improve the level of a grade
In fact, jquery and native JS does not have much difference between the bottom of the jquery or call native JS but jquery's API encapsulates the differences in browsers to provide a convenient way to deal with the development of
JS is all done. jquery is only a JS framework, JS Framework is many. This is just better. It is strongly recommended to learn JS, do the project when using jquery on the line.
When you learn the advantages of JS is that you learn more things to deal with browser compatibility issues and so on. will give you accumulated experience.
When you do a project, jquery is a bit more efficient, and the cost of development is reduced by as much as N times.

4, JS: Simple things to achieve a complex
jquery: Complex things are easy to implement
On performance, jquery is a lot worse.
5, jquery is used to write the function of JS library, we usually use the effect of the package to achieve, and then use only need to call. Need DIY, of course, still need to use JS.
6, JS is the foundation, jquery is just a tool, the foundation is very important

Http://www.jb51.net/article/28056.htm

As far as we can see, most people use jquery for only two aspects, a DOM selection, and derivative. Children,.siblings Wait, another is event binding, what other loops, method declarations Ah, Not all of the commonly used settimeout are native.

I think jquery and the original should not think that is antagonistic relationship, a jquery master will certainly use JS class Ah, understand the prototype chain Ah, understand the DOM these things, so should not think that the original is strong, with jquery is not the idea of this.

Your HTML structure is complex, with the jquery selector again convenient, the design requirements of the effect is particularly harsh, with jquery animation and special effects are suitable, these are understandable things, but you can not be a bit without the original JS and only jquery, it is impossible, Variable declarations are native JS.

So when you interview the opposite to ask you what the original JS used when you can confidently say that, in addition to DOM selection and Eventlisterner not too familiar with, other than the other problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.