当前位置:网站首页>Ecmascript6 interview questions
Ecmascript6 interview questions
2022-06-12 07:44:00 【It's a fish, a small meatball, a duck】
1. Please describe let And const as well as var The difference between ? And what is a temporary dead zone ? What is variable Promotion ?
difference :
Temporary dead zone :
Variable Promotion :
2. Please tell me what you think of es6 The understanding of template string ? What are the characteristics of ?
3. Please tell us the difference between arrow function and ordinary function ?
4. What are the default parameters of a function ?
5, Please say Object.assign() What's the use of ?
6. Please tell me what you think of promise The understanding of the ? And say promise How do you use ?
7. Please tell me what you think of es6 Modular understanding ?
8. Please say es5 And es6 The difference between ?
9. Please tell us what you should pay attention to when using the arrow function ?
1. Arrow function does not have its own this object
(1) Ordinary functions ,this Points to the event source itself , If there is nesting inside ,this The direction of will be shifted
(2) Arrow function ,this Point to the object that called the function (this The direction of is static )
2、 Arrow functions cannot be used as constructors , That is, the arrow function cannot be used new command , Otherwise, an error will be thrown
3、 Not available arguments object , The object does not exist inside the function , If you want to use , It can be used reset Parameters instead of
4、 Not to be used yield command , So the arrow function cannot be used as Generator function
10. Please say es6 What are the new features ?
11. Please tell me what you think of es6 class Class ?
12. Please say what is deep copy , What is shallow copy ? And how to realize deep copy and shallow copy ? use es6 How to realize deep copy ?
Before you know about shallow and deep copies , Let's get to know js Data type of
js There are two types of data
One is basic data type : character string (String)、 Numbers (Number)、 Boolean (Boolean)、 In the air (Null)、 Undefined (Undefined)
One is the reference data type : object (Object)、 Array (Array)、 function (Function)
Variables of basic types are stored in stack memory , Reference data types are placed in heap memory , The basic data type holds values , The reference data type usually stores the address of the object .
If we simply copy , Maybe it's just the address of the copied object , So this is the shallow copy , If the object is cloned , Changed the address of the reference object , So it's a deep copy
A shallow copy is a copy of a pointer to an object
Deep copy is the cloning of objects , And re point to a new address in the heap
Only reference data types have shallow and deep copies , The basic data type is assignment
The difference between a shallow copy and a deep copy is : See if the copied sub object points to a new address in heap memory
The idea of implementing a deep copy :
- Check the type , Determine whether the type is a reference type , If yes, make a deep copy , Otherwise shallow copy
- Using recursion
- Check the ring , Determine whether the current reference points to itself , Avoid going into an endless loop
- Need to ignore prototypes
Fast deep copy method
Get a new object by serializing and deserializing ,JSON.parse(JSON.stringify(a)); shortcoming : Will ignore Function、Symbol、undefined, Cause attribute loss , If you know that the types of deep copy objects do not contain these types , This method is quite easy to use .
Third party tools :jquery Provide a $.extend Can be used to make deep copies ,lodash Provided by function library _.cloneDeep It can also be used to make deep copies
13. Give me a few ES6 Yes String Common upgrade optimization for string type ?
14. Give me a few ES6 Yes Array Common upgrade and optimization of array type ?
15.Map What is it? , What's the role ?
16.Set What is it? , What's the role ?
17.Proxy What is it? , What's the role ?
18.Class、extends What is it? , What's the role ?
19. Often in front-end code development , What are worth using ES6 To improve programming optimization or specification ?
20. What is? Babel?
边栏推荐
- ‘CMRESHandler‘ object has no attribute ‘_ timer‘,socket. gaierror: [Errno 8] nodename nor servname pro
- Leverage contextual information
- Right click the general solution of file rotation jam, refresh, white screen, flash back and desktop crash
- Voice assistant - those classification models used in the assistant
- Summary of machine learning + pattern recognition learning (II) -- perceptron and neural network
- MySQL索引(一篇文章轻松搞定)
- [RedisTemplate方法详解]
- Connect to the database but cannot modify the data
- Model deployment learning notes (I)
- Leetcode34. find the first and last positions of elements in a sorted array
猜你喜欢

Meter Reading Instrument(MRI) Remote Terminal Unit electric gas water
![‘CMRESHandler‘ object has no attribute ‘_ timer‘,socket. gaierror: [Errno 8] nodename nor servname pro](/img/de/6756c1b8d9b792118bebb2d6c1e54c.png)
‘CMRESHandler‘ object has no attribute ‘_ timer‘,socket. gaierror: [Errno 8] nodename nor servname pro

Right click the general solution of file rotation jam, refresh, white screen, flash back and desktop crash

Missing getting in online continuous learning with neuron calibration thesis analysis + code reading

2022 electrician (elementary) examination question bank and simulation examination

Topic 1 Single_Cell_analysis(4)

Voice assistant - Multi round conversation (process implementation)

Fcpx plug-in: simple line outgoing text title introduction animation call outs with photo placeholders for fcpx

Golang quickly generates model and queryset of database tables

2022 simulated test platform operation of hoisting machinery command test questions
随机推荐
Voice assistant -- Architecture and design of Instruction Assistant
What is a good recommendation system?
2021.10.24-25 scientific research log
In depth learning - overview of image classification related models
Summary of semantic segmentation learning (I) -- basic concepts
20220526 损失函数
连接数据库却无法修改数据
謀新局、促發展,桂林綠色數字經濟的頭雁效應
Federated reconnaissance: efficient, distributed, class incremental learning paper reading + code analysis
R语言glm函数构建泊松回归模型(possion)、epiDisplay包的poisgof函数对拟合的泊松回归模型进行拟合优度检验、即模型拟合的效果、验证模型是否有过度离散overdispersion
Topic 1 Single_ Cell_ analysis(2)
‘CMRESHandler‘ object has no attribute ‘_ timer‘,socket. gaierror: [Errno 8] nodename nor servname pro
Vs2019 MFC IP address Control Control inherit cipaddressctrl class redessine
Summary of machine learning + pattern recognition learning (IV) -- decision tree
The R language catools package divides the data, the scale function scales the data, the KNN function of the class package constructs a k-nearest neighbor classifier, and compares the model accuracy u
10 lessons from the recommended system
Bi skills - beginning of the month
Gradient epic memory for continuous learning
Voice assistant - Measurement Indicators
Leetcode notes: biweekly contest 79