1. JS basic data types and reference types

Basic data types: number, string, NULL, undefined, Boolean, symbol — Stack reference data types: Object, array and function — The two data types are stored in different locations. Primitive data types are simple data segments directly stored in the stack, occupying small space and fixed size, and are frequently used data. Reference data type Objects stored in the heap occupy large space, size is not fixed, if stored in the stack, will affect the performance of the program; The reference data type stores a pointer on the stack to the starting address of the entity in the heap. When the interpreter looks for a reference value, it first retrieves its address in the stack and then retrieves the entity from the heap.

2. Introduce the built-in objects of JS

Function, Data, Math, Arguments, RegExp, Error ES6 Promise, Proxy, Map, Set, Symbol, Reflect 3. A few basic JavaScript specifications

Variables and functions declare before use add semicolon code snippets after use wrap with {} Define constructors with uppercase, define constants with {} and [] declare objects and arrays with === and! == to compare true and false or numeric values

What does Eval do

Its function is to parse the corresponding string into JS code and run; It is unsafe and very energy intensive (executed twice, once parsed to JS code and once executed) 5. Understanding closures

A closure is a function that has access to variables in the scope of another function. The most common way to create a closure is to create another function in a function and access local variables of the function through another function. Closures can be used to break through the scope chain and pass variables and methods inside the function to the outside

6. Introduce JavaScript prototypes, prototype chains? What characteristics

Prototype:

All JavaScript objects contain an internal property that corresponds to the object’s prototype. In addition to proto, When a function object is used as a constructor to create an instance, the prototype property value is used as the proTO of the instance object. The prototype chain:

When an object calls a property/method that does not already exist, it will look for the prototype object associated with it. If not, it will look for the prototype object associated with it. And so on until property/method or undefined is found. This leads to the so-called “prototype chain” prototype characteristics:

JavaScript objects are passed by reference, and when you modify a stereotype, the objects associated with it inherit the change

The actual interview

www.gtalent.cn/exam/interv…