How to learn JavaScript in a systematic way

Source: Internet
Author: User

In the past, JavaScript was used only to make simple web effects, such as forms validation, floating ads, and so on, when JavaScript was not taken seriously. Since Ajax has become popular, it has been found that the use of JavaScript can give users a better experience, and even use this advantage to develop large-scale web games, so this small language is valued. Now, many companies recruit specialized JavaScript engineers, usually JavaScript is the necessary skill for web front-end development. Brief introduction of the benefits of javascriptr, does not mean that everyone will go to learn or even learn it well, interest is very important, I think interest is the best teacher, it is you concentrate on doing one thing and make it a good motivation. In addition, we have to believe that the small language has a big, I have written some very useful tools, such as you can use Javascript+greasemonkey to write online web game plug-in program. Greasemonkey Let's talk about the course and experience of my learning JavaScript.

Getting Started
    1. Learn Div+css layout

Using the DIV+CSS Layout standard Web page, you can make the front-end XHTML code less and more structured, which makes it easy to manipulate the DOM with JavaScript, for example, to show a list of 3 rows and 3 columns, and if you use a traditional table layout, you are now using JavaScript to dynamically generate this list , then you need a loop nesting, and if you use the LI structure plus CSS floating layout, a loop is good. Of course, web normalization is not necessarily a form that cannot be used, I mean that structured XHTML is easier to integrate JavaScript effects or functionality into a project.

    1. Master several development test tools

As a developer, it is necessary to be familiar with testing tools, which helps to improve the efficiency of finding and solving problems, especially for particularly large projects. JavaScript and XHTML Development Test Tool I will first recommend the two most commonly used, they are: Web developer and Firebug.

    1. Familiarity with the role of each JavaScript method

This requirement may sound a little unrealistic, and I think this requirement is true for large languages like C # and Java, because these language libraries are so large that no one can fully remember them, and there is no need to remember them all. For example, using Java to do Web pages and mobile phone development focus on the class library is not the same. And JavaScript is not, its built-in method function is really not much, first fully familiar with, development will be handy, for example, you may initially think that JavaScript has trim () this many languages have to go to the line of the tail space, Once you understand the JavaScript built-in libraries, you'll find that in JavaScript these methods are meant to be implemented on your own. For example, if you're going to play JavaScript from other powerful languages, you might think that JavaScript should have a MD5 encryption method, which is not, of course, but someone uses JavaScript to implement this method, JavaScript MD5. In the end, the JavaScript built-in approach is less pathetic, but many cows have written new ways to add JavaScript functionality, such as the prototype framework, which essentially extends the JavaScript base functions.

    1. Understanding DOM Programming

Understanding DOM Programming is an important lesson in learning JavaScript, because JavaScript, in addition to writing some purely data-processing logic, is changing the structure and content of XHTML dynamically to achieve the purpose of dynamically updating the interface, which relies on DOM programming. The jquery framework is well-encapsulated in this area, providing a rich DOM approach that allows you to easily find a DOM node (XHTML tag) anywhere on the page, and then perform related operations (add, delete, change, check). For those of you who have experience working with XML documents in other languages, I believe this piece will get you started.

    1. Touch and use Ajax

Today, learning JavaScript without using AJAX is an advantage of JavaScript (Ajax itself is not a JavaScript content). Ajax for users and servers are good, for users, to provide a better user experience, the most typical of a scenario: the registration page user name Usability pre-detection, the traditional may encounter such a problem: the user filled out a bunch of data after the submission of the form, the result was the server told the user was registered, To re-fill the data registration, this is very large multi-user site that is very deadly, because the user loses 10 user names may be half already used. For the server, reduce web traffic, because after Ajax, the general is to load the data on demand, not because the local update to reload the entire page. For example, a webpage occupies three screen height, we can load the content of the first screen by default, and then load the content of two or three screen when the user pulls the scroll bar down. In addition, like the Web online map application is also an example of Ajax use.

Improve
    1. In-depth understanding of the JavaScript this keyword

The role of JavaScript this is very different from that of a lot of really object-oriented development languages, and it does not always point to the current object, it will change. If you do not pay attention to this problem, it is possible to encounter the seemingly correct code error or not to execute the problem.

    1. Learn JavaScript OOP programming

OOP is a good thing, it makes programmers think about problems more organized, and the organization of code is clearer. JavaScript can also be oop, but there are also big differences with some of the traditional OOP languages, so it takes some effort to actually use the cooked JavaScript oop.

    1. Understanding closures

JavaScript closures are also a topic of much talk, and closures complicate the scope of JavaScript variables, but this feature makes the language more flexible.

    1. Learning Norm Development

Team spirit believe that we have heard a lot, the inauguration of a company to do development, of course inseparable from the team, the team want to cooperate happily, each member of the code must conform to certain norms, which is the basic requirements of each company programmer. As for the specification, it usually refers to the naming of variables, the organization of documents, the specification of annotations, and so on, which is interlinked with other language norms.

    1. Read the book for this algorithm

I think learning and using a language is not difficult, it is difficult to use the basic language of grammar and sentence to solve some complex problems. To solve some of the complex problems, some algorithms may be used, some of the implementation of the algorithm may be a team doing, such as the Chinese Academy of Sciences, the specific implementation of Word segmentation, as well as the game commonly used automatic path finding a * algorithm. Maybe you think you can't have such a complicated problem in JavaScript development, in fact, it depends on what you are doing, if you are developing a large web game, often faced with more challenging problems, if you have read some algorithmic books, to understand some of the solutions to common problems, In the development process will naturally be more powerful. In addition, familiarity with algorithms is obviously helpful in your future exposure to other development languages.

Habits
    1. Compatible, bug-related notes

CSS and JavaScript browser compatibility issues are best to take notes, because these problems, or bugs are more bizarre, these problems the browser will not prompt you wrong, the IDE will not prompt you, especially CSS compatibility issues, This will cause you to encounter such problems in the development process that the card long time will not be resolved. Even if previously solved the same kind of problem, may later encounter, the result did not take notes to strengthen the memory, doomed you to suffer again, because these compatibility problem is not one or two, temporary memory effect is not obvious. In my experience, a lot of problems occur under IE6, and now IE6 even Microsoft wants to accelerate its demise, which is of course a good news for us in front-end development.

    1. Read good code, like jquery

Reading good code is definitely a good way to improve yourself, not only to understand the organizational specifications of good code, but also to understand some of the implementation of the idea of the function. jquery, for example, is a very value-learning JavaScript framework. Of course, to read such a professional JavaScript framework, JavaScript Foundation to be solid, otherwise see the process will encounter too many doubts, even to their own confidence is a blow.

Note
    1. Avoid using JavaScript frameworks directly before you get started with JavaScript

If you don't have any JavaScript basics, do not use the JavaScript framework directly, and I think this may mislead you into understanding a language, such as using a jquery-linked statement, Do you think this is a kind of javascript syntax? For example, you made prototype. You should not think of the base class method of the framework extension as JavaScript built-in. I think the JavaScript framework is used to improve efficiency, and it's definitely not a JavaScript primer to learn.

    1. Many examples of online search may not be cross-browser compatible

There are many JavaScript effect source is n years ago, a Netizen wrote, n years ago is the world of IE, so some front-end lazy to solve the script cross-browser compatibility issues, so that the script written only for IE. When you get a piece of code like this, don't say rubbish, and don't whine about it, because the code is not worthless, and if you understand JavaScript cross-browser compatibility issues, you can easily make your code more compatible with fewer changes.

How to learn JavaScript in a systematic way

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.