Home > Web Front-end > JS Tutorial > Common interview questions about JavaScript

Common interview questions about JavaScript

微波
Release: 2020-07-30 15:57:33
Original
3574 people have browsed it

Common interview questions about JavaScript

Regarding the JS scope issue, it is an interview question that interviewers never tire of asking during interviews. Sometimes it is really frustrating. The following article mainly shares with you javascriptSome common interview questions about scope, friends in need can refer to them. Let’s take a look below.

Recommended related articles:The most complete collection of js interview questions in 2020 (latest)

This article mainly shares with you the relevant content about the JavaScript scope interview questions, and shares it for your reference and study. Let’s take a look together.

1. Scope:

Before understanding scope, you first need to understand some basic concepts:

Every variable, function has its scope, and it cannot be used beyond the scope. This is called scope.

2. Global variables, local variables:

1. Global variables:

 (1) Variables declared in the global scope, such as var a=1;

 (2) Only assigned values ​​without declaration, such as a= 2; (Note: If a=2 is in the function environment, it is also a global variable)

2. Local variables:

Variables written into functions are called local variables.

3. Function:

(1) Program safety.

(2) Release of memory.

3. Scope chain:

The process of finding the quantity. First, check whether there is a declaration or function in your local environment. If there is, check whether the declaration has an assignment or the content of the function. If not, search up one level.

4. Pre-parsing sequence:

Every program has to do the work. The program starts by pre-parsing the grammar and whether there are punctuation marks. If there is an error, analyze whether the memory can be accommodated, analyze the variables... until the analysis is correct, start to follow the normal process sequence. Just imagine, if there is no pre-parsing sequence and the process sequence is followed directly, the program may execute until the last function, find syntax error, and then start to report errors. How bad will the performance be!

Sequential content:

## 1. The
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template