1. What are the js data types and what are the differences?
Basic data types: String, Number, Boolean, undefined, Null, symbol, address stored in the stack Reference data type: Object, address stored in the stack, ontology stored in the heapCopy the code
2. Talk about your understanding of scope
Concept: defines the scope of use of variables; Classification: global scope, function scope, block-level scope, of which block scope is a new addition in ES6, while function scope and block scope are collectively referred to as local scope. Scope chain: Each layer of scope is an execution environment. When executing a program in this environment, a variable object is created, which contains its own variables and functions. When searching for invariants in the current execution environment, it will search in the scope of the upper layer. The specific process is still to find the variable object of the upper layer, and then to find the corresponding variable in the inside. If still not found, continue to go up...... ; All the way to the outermost scope, the global scope, a chain is formed, called the scope chain.Copy the code
3. Talk about your understanding of prototypes and prototype chains
Prototype: Create a function. Each function has its own prototype property that points to its prototype object. The prototype object generates a constructor property that points to the constructor by default. Function: data sharing to achieve inheritance. Prototype: when accessing a property of an Object, the first method is to check whether the property is present or not. If not, the first method is to check whether the property is present or not. If not, the method is to check whether the property is present or not. '__proto__' each function has a prototype object (display prototype)Copy the code
4. What closures and what are the downsides?
Definition: a function nested within another function that can access the variables of the external function. Advantages: Variables reside in memory for a long time, avoiding variable pollution and private members. Disadvantages: Increased memory usage, will cause memory leaksCopy the code
5. How do I change the direction of this? What’s the difference?
Call, apply, and bind. This. Dushi refers to window when their first arguments are undefined and null. Call and bind take an infinite number of arguments, and apply takes two arguments, the second of which is an arrayCopy the code
6. What is the principle of event delegation or time delegation?
Event bubbling principleCopy the code
7. What is the difference between event bubbling and event capture?
Event bubble: Target element -->body--> HTML --> Document Event capture: Document --> HTML --> Body --> target elementCopy the code
8. What new es6 features do you know of?
1. Added let and const 2. Extended operators 3. Attribute name and attribute value can be abbreviated 5. Use of class 6. Arrow function 7. Deconstruct arrays, objectsCopy the code
9. How many asynchronous js programming methods are there?
Callback functions, generate, promise, async/awaitCopy the code
10. How many states does a promise have?
This is a pending pity, rejectCopy the code
Note: the writing may not be complete, hope you give more comments, thank you!