Don't tell me you know Javascript

original
2012/07/12 12:56
Reading number 637

In the past few years, I have noticed a very strange phenomenon in the technology circle. Too many programmers have written their resumes about technologies that they have only a very superficial understanding but do not understand at all. This phenomenon exists in almost every language, but the most serious one is Javascript.

You don't know You don't understand

One of the major reasons for this situation is that nowadays almost every developer's work depends more or less on Javascript, but most people do not really understand the language. Their common way of learning is copy and paste. Using this way, you will never really learn the language, but only get a false impression that you have already understood. According to my experience in learning and using Javascript in the past few years, before you know it, you will not know that you do not understand it, which sounds a bit confusing. What you really need is someone to tell you that you do not understand it, and you need comprehensive and systematic learning. I often interview some guys who proudly list Javascript in their resumes, but they can only do simple onClick processing or form validation. There is no problem using frameworks like jQuery or Dojo, but unless you can understand the Javascript technology hidden behind these frameworks, you can't really grasp the energy of these toolkits. Here are the Javascript knowledge points I divided from low to high, which are divided into three parts: basic, intermediate and advanced. Let's see how much you know:

Basic knowledge of Javascript

  • Know basic programming syntax, such as loop, judgment, try/catch, etc
  • Understand various function definitions and assignment methods, including anonymous functions
  • Understand the basic namespace, global (window) space and object space (excluding closures)
  • Understand the role of context and the use of this variable
  • Understand the initialization and declaration methods of various objects and functions
  • Understand Javascript comparison operators, such as<,>,==,===, as well as the principle of object and string comparison and object mapping
  • Understand the array index of object properties and functions, and the difference between this and real arrays.

Intermediate knowledge of Javascript

  • Understand timers and how they work, including when and how to use timers to asynchronously execute method calls
  • On the deep support of callbacks, and how to control the context and function parameter transmission through call and apply methods
  • Understand JSON tags and eval functions
  • Understand closures and how they affect your code efficiency
  • AJAX and object serialization

Advanced knowledge points of Javascript

  • To understand the "arguments" variable of the method, including how to use it to overload functions through arguments. length and make recursive calls through arguments. call, you need to pay attention to the danger of using this feature, because the Strict mode of ECMAScript 5 does not support this function, but it is used by jQuery and Dojo.
  • Advanced closures such as self memorizing functions, partially applied functions, and the cutest (function() {}) () calls.
  • Functions, HTML prototype, prototype chain, and how to use basic Javascript objects and functions (such as Array) to simplify code.
  • Object type and use of instanceof
  • Regular expressions and expression compilation
  • With statements and why not use them
  • The most difficult part is to know how to use all these tools and generate clean, tidy, robust, fast, maintainable and compatible code for different browsers.

The last point here is particularly important and is also the most difficult to implement. Because Javascript is inherently not strict in syntax, your program will easily become spaghetti like disaster code that is difficult to maintain. Once you start learning the Javascript language itself, you can only really master it through continuous practice in large Web programs, which may take several years, And you can't learn this from books. I have been using javascript for several hours every day for several years, but I am still looking for better ways to write and reconstruct my code. For this reason, using a framework like jQuery at the beginning will be dangerous, and it will easily make your code unmaintainable, Dojo's Class and Package systems can be of some help.

Considering that javascript has infiltrated into the back-end through projects like Node.js, I decided to pull out the parts related to the Web separately, that is, if you want to use javascript in Web development, then the following are what every good programmer should know:

  • How to efficiently operate Dom (add, delete and update), and how to minimize re flows of browsers by using tools such as document fragments.
  • The browser's DOM element attribute extraction (for example, style, position, etc.), jQuery and Dojo can well complete these tasks. However, it is important to understand the difference between extracting attributes from CSS and style tags, and how to calculate position and size.
  • Event processing, binding, anti binding, bubbling, and how to obtain the expected callback context of the browser. At one time, the ready-made framework can also handle these things well, but you should understand the difference between IE browser and W3C standard browser.
  • Regular expression selects DOM node
  • Browser function detection and intelligent degradation

As you can see from the above list, for Javascript, except alert (myval) or myBtn. onclick=, You also need to know more things, which can't be learned by pasting and copying. Only through reading and practicing can you become a real javascript programmer. Here are two good books about Javascript, "the good parts" and "the secrets of Javascript ninjas". If you just want to decorate your resume, I suggest that you at least understand the knowledge points in the basic stage, and at least try the technologies in the intermediate stage. Once you find that when you start to develop the functions you want, instead of copying and pasting from others, you can declare that you know Javascript. Please don't say that before that.

If I miss any concept about Javascript, please leave a message for me, and don't forget to share any of your experiences about JS or other languages.

It should be noted that I am not a front-end developer. I am actually a back-end developer, but because of the needs of the situation, I have gradually become a full protocol stack developer. Now, almost every back-end developer needs to understand Javascript, which is also the purpose of this article. I do not want to express how much I know about Javascript, I just want to say that javascript is a very powerful and complicated language, which is far more complex than what you first see.

This article is translated from " You Don't Know JavaScript ", Author: Michael Woloszynowicz

Expand to read the full text
Loading
Click to join the discussion 🔥 (1) Post and join the discussion 🔥
Reward
one comment
nine Collection
three fabulous
 Back to top
Top