Home  >  Article  >  Web Front-end  >  Ten concepts every JavaScript developer should know

Ten concepts every JavaScript developer should know

小云云
小云云Original
2017-12-05 10:45:251319browse

There are many people learning JavaScript and web development now, and they all hope to get a job based on it. However, self-study often leaves learners with knowledge blind spots in their understanding of the JavaScript language itself.

In fact, it is surprising that they only need to master very little knowledge of the language to create complex web pages, but this usually does not provide a good grasp of the basics of JavaScript.

It is quite easy to use basic skills to implement functionality and avoid complex requirements, and it is also very easy to create a website by relying on Stack Overflow without understanding the copied code.

Interview

But the problem is that when many technology companies ask questions in interviews, the purpose is to test whether you really understand JavaScript. When a candidate has only a superficial knowledge of JavaScript, rather than a deep understanding of the language, the interviewer will quickly understand what is going on.

Here are some common concepts used in web development interviews. Of course, we assume that you are already familiar with basic concepts such as loops, functions, and callbacks.

Concept

1. Original value and reference value (Value vs. Reference)

Understand how objects, arrays and functions are copied and passed into functions. Understand what the reference value is copied and understand that the original value is copied and passed by copying the value.

2. Scope

Understand the differences between global scope, function scope and block-level scope. Understand where variables are available and understand how the JavaScript engine performs variable lookups.

3. Hoisting

Recognize that the declaration of variables and functions will be hoisted to the context in which they are declared, that is, within the scope of the variable. No matter where the variable is declared, it will be Promoted to the top of the scope, but the order of variable initialization remains unchanged. Recognize that function expressions are not promoted.

4. Closures

Recognize that a function retains access to the fields created within it, and realize what this allows us to do, such as data hiding, memoization and dynamic function generation.

5. this

Understand the rules of this binding. Know how it works, know how to determine what it's equivalent to in a function, and recognize why it's useful.

6. new

Recognize how it relates to object-oriented programming. Understand what happens to functions called via new. Understand how objects that inherit from a function's prototype property are generated by using new.

7. apply, call, bind

Understand how these functions work and how to use them. Understand what they do to this.

8. Prototypes & Inheritance

Understand that inheritance in JavaScript works through the [[Prototype]] chain. Understand how inheritance is set up through functions and objects, and how new helps us achieve this. Learn what the __proto__ and prototype properties are and what they do.

9. Asynchronous JS(Asynchronous JS)

Understand the event loop and how the browser handles user input, web requests and general events. Know how to recognize and correctly implement asynchronous code. Understand what asynchronous and single-threaded are in JavaScript. .

10. Higher Order Functions

Understand that these functions are first-class objects in JavaScript and what that means, and that it is perfectly legal to return a function from another function of. Understanding the techniques closures and higher-order functions allow us to use.

Do you have anything to add? Share it with everyone in the comment area~

The above content is the concept that ten JavaScript developers should know. I hope it can help everyone.

Related recommendations:

10 interesting JavaScript scripting languages

How JavaScript works

10 Interesting Javascript and CSS Libraries

The above is the detailed content of Ten concepts every JavaScript developer should know. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn