What is the best way to learn JavaScript?

You do not know that you do not know

The reason for this is that almost every web developer came across about the need to handle JavaScript . As the most common approach to remembering JavaScript without understanding , search the sample code on the fly and copipe. The problem with ‘learning’ in this hand is that developers do not actually learn that language, and additionally they misunderstand that they know it. The fact that I learned while working with JavaScript for years has me learned that I do not know for the first time I really understand it. This is a kind of circulating story, what you really need is a person who tells us that you do not understand, it is real learning. Although I’ve only done simple onClick handlers and form validation merely linking sample code, I have interviewed too many with prosely someone who lists JavaScript in my resume. It is a good idea to use a framework like jQuery or Dojo , but without properly understanding the JavaScript behind them you will not master those toolkits. Below is the idea that I think as basic knowledge, intermediate level, advanced level knowledge to express many elements of JavaScript .

Basic level of JavaScript understanding

  • Know basic programming tools, such as loops, if statements, try / catch etc.
  • Know that there are various methods for function definition and application. The same applies to anonymous functions .
  • Understand the basic scope definition principle, global scope ( object ) versus object scope (closure).
  • Understand the role of context and how to use this variable .
  • Understand the various ways of instantiating and declaring objects . The same is true that the function is an object .
  • Understand what is false with JavaScript comparison operators such as ‘<‘, ‘>’, ‘==’, ‘===’ and how objects and strings are compared. Cast as well.
  • How Array indexes attributes and functions of objects and how it differs from real arrays. ( Object literals vs. array literals).

Intermediate level of JavaScript understanding

  • Understand how the timer works, that is, when and how it will be available. The same applies to asynchronous method calls.
  • Know the callback and function application deeply. For example, you can manipulate the context with the ‘call’ and ‘apply’ methods and pass the function as an argument (function argument passing).
  • Understand JSON notation and eval function .
  • Understand how closures affect code performance and how they are used to create private variables .
  • Familiar with calling (lovely), (function () {}) ().
  • AJAX and the object of the serialization

Advanced level of understanding of JavaScript

In this paragraph, I do not think much of the specific situation, so there are some doubtful parts so JS advanced users should refer to the original text.

  • Understand the arguments variable of the method , how can it be used , overload the functionwith arguments.length, and recursive call with arguments.callee ? Let’s add that the use of arguments.callee is dangerous, as can be seen from ECMAScript 5 ‘s Strict mode not supported * 1 . Even if both jQuery (up to version 1.4) and Dojo are using it.
  • How to use higher closures like self-memoization, currying, partial application of functions
  • Functions and html proto -typing , i.e. prototype chain and basic JavaScript objects and functions (eg: Array) the use to reduce the code that.
  • How to use Object type, instanceof and typeof
  • Regular Expression and Regular Expression Compilation
  • With statement and why should not you use it
  • The most difficult thing is to combine all of these tools into a clean, clean, robust, fast and maintainable cross-browser compliant code.

The last point of the advanced level is particularly important and hardest to reach. Given the inadvertent nature of JavaScript , it easily goes into a vicious circle of spaghetti code that can not maintain your application . Once you learn the JavaScript language itself you can truly master it by organizing it and binding it to each other in the context of large applications. It requires a couple of years of training and failure, and one book can not be acquired. I am using JavaScript on a daily basis for several hours every day for several years and I am continuing to find a better way to write my own code.

For these reasons, it is dangerous to jump a step further to some framework, and jQuery code tends to be unmanageable. Dojo encourages this by its own class and package system.

Since JavaScript is now penetrating to the back end by Node.js etc., we decided to separate the above listed requirements from the web-specific knowledge. The aspect of the web (ie DOM and IE) gave JavaScript a bad name , trembling all programmers and making it jerky. If you try to use JavaScript in the context of the web, there are additional items that all good developers should know.

  • Effectively manipulating DOM and it. That is, adding, deleting, changing nodes. The same applies to text nodes.
  • Including using a tool such as Document fragment to minimize browser re-flow.
  • Extract information from the DOM in a way that is compatible with cross-browser (eg style, position etc.). Such things are done very well with frameworks such as jQuery and Dojo, but understand the difference between extracting information as represented by CSS versus style tag and specifying position and size It is important.
  • How to achieve event handling, binding , unbinding , bubbling, ie the desired callback context with cross browser support . Again, this is handled very well if it is via the framework, but individuals should also understand the difference between IE and the W3Cstandard browser .
  • Expando vs. attribute setting and their performance are different, there is a mismatch (naming discrepancies) with the name.
  • Regular expression to extract DOM node
  • Effectively detect browser functions and graceful degradation of them (graceful degradation).

If you do not copy and find that you are developing the function you want, you can assert that you know JavaScript . Until then do not advertise that you know JavaScript and so on .Until then do not advertise that you know JavaScript and so on .

If you have aspects of JavaScript I missed, please let me know from comments. Also, please share the experiences I’ve met with people who claim to know JS and other languages.

In addition, I am not a front-end developer, but a back-end developer and I have evolved to a full stack developer. Today, almost all backend developers need to learn JavaScript , which is what the article is intended to do. There is no intention to look down, not to say that everything in JS is known. My hope is that more people are aware that JavaScript is a vast and powerful language, more than it looks.