当前位置:网站首页>In 2022, it will be es2022 soon. Do you only know the new features of ES6?
In 2022, it will be es2022 soon. Do you only know the new features of ES6?
2022-07-04 13:20:00 【Boyue classmate】
2022 year , Right now ES2022 了 , Still watching ES6 Knowledge points of ?
During the interview , Interviewers always like to ask questions you know ES6 What are the new properties of ?
actually ,ES6 All are 2015 The standard issued in , Now are all 2022 year , Also take this exam , It's a little out of date .
Today I'll take you to clean up , Over the years , from ES2015(ES6) To ES2021 What features have been added
One 、ES2015(ES6)
newly added let const Used to declare variables const a = 1 ; let b = 2
New variable deconstruction let [a, b, c] = [1, 2, 3];
Strengthen the right Unicode Code support ‘\u007A’ === ‘z’ // true
increase String Property method of fromCodePoint、raw、codePointAt
Added the traversal interface of string
for (let codePoint of 'foo') {
console.log(codePoint)
}
Add the instance method of the string includes()、 startsWith()、 endsWith()、repeat()、 padStart(),padEnd()、trimStart()、trimEnd() 、matchAll()、at()
Modified some parameter settings of regular expression and added some properties ( Too much , If you don't list it in detail, just )
Modified the way of specifying the default value of the input parameter of the function
Added the deconstruction method of array (… Operator )
Added the concise writing of objects for example {test} It is equivalent to {test:test}
Added Set Map Two data structures
increase Proxy Constructors (vue It is also based on this upgrade )
increase Promise object , Used to solve asynchronous programming
newly added class keyword ( Grammatical sugar ), Changed the way the previous prototype was written
increase import export Used for module programming ( I've been using it before , It's just ES6 after , Community standards have become official standards )
Of course , There are other changes , Relatively speaking, it uses less , I won't mention it here
Two 、ES2016(ES7)
New array includes attribute
Introduced ** Operator ( Exponential operators ) Example 2 **3 //8
3、 ... and 、ES2017(ES8)
increase async await Make it possible to change asynchronous to synchronous , Avoid back and forth nesting of code writing
increase Object.values() Object.entries()
increase String padding:String.prototype.padStart、String.prototype.padEnd
Comma at the end of function parameter list is allowed
add to Object.getOwnPropertyDescriptors(): Get descriptors of all properties of an object , If there is no self property , Then return the empty object
newly added SharedArrayBuffer object : Used to represent a general , Fixed length raw binary data buffer
newly added Atomics object : Provides a set of static methods for SharedArrayBuffer Object to perform atomic operations
Four 、ES2018(ES9)
Allow asynchronous iterations :await You can talk to for…of To use together , Run asynchronous operations in a serial fashion
add to Promise.finally()
Modified some properties of regular expression ( This one is more detailed ,mdn Just check how to use it at present )
5、 ... and 、ES2019(ES10)
Revised try catch Use ,catch You don't have to enter
Increase the of the array flat flatMap Method
Add the string trimStart, trimEnd Method , Remove the leading and trailing spaces
increase Object.fromEntries Method , You can turn the corresponding array into an object
increase Function.prototype.toString() It is convenient to see the internal code corresponding to the function
increase Symbol.prototype.description Method
Example Symbol(‘test’). description === ‘test’ // true
Yes JSON Object optimization JSON.superset 、JSON.stringify
6、 ... and 、ES2020(ES11)
increase Bigint Used for large number calculation
Add optional chain Simplify writing judgment
increase ?? operation , If the left side is not null perhaps undefined Then return to ?? Left side content
It's solved let num = number || 1 This calculation method is bug
increase Promise.allSettled Method
Support import() The function is used for asynchronous loading
7、 ... and 、ES2021(ES12)
Add the string replactAll Method , Replace all before , You need to use regular expressions
increase Promise.any Method
New logical assignment operator ??=、&&=、 ||=
Add underline (_) Separator : Use _ Separate numbers and literals for easy reading 1_0000 === 10000 //true
as well as WeakRefs、Intl.ListFormat、Intl.DateTimeFormat( These three are generally not used much , If you are interested, please check it by yourself )
attach 、
2015 year 6 Officially released in ES6, Also known as ES2015, Every year since then, some contents will be revised and published in 6 Release the corresponding year number in the month ES edition , such as ES2016~ES2021.ES2021 yes ECMAScript The second part of language norm 12 edition , Also known as ES12. In the future, in order to avoid confusion , Let's call it by year ! The province also makes a conversion .
边栏推荐
- It is six orders of magnitude faster than the quantum chemical method. An adiabatic artificial neural network method based on adiabatic state can accelerate the simulation of dual nitrogen benzene der
- Understand bloomfilter in one article
- AI painting minimalist tutorial
- 6 分钟看完 BGP 协议。
- Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- [Android kotlin] lambda return statement and anonymous function
- 7、 Software package management
- BackgroundWorker用法示例
- SQL statement syntax error in test SQL statement deletion in eclipse linked database
猜你喜欢
CVPR 2022 | transfusion: Lidar camera fusion for 3D target detection with transformer
Practice: fabric user certificate revocation operation process
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
8个扩展子包!RecBole推出2.0!
Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
It is six orders of magnitude faster than the quantum chemical method. An adiabatic artificial neural network method based on adiabatic state can accelerate the simulation of dual nitrogen benzene der
《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话
6 分钟看完 BGP 协议。
Full arrangement (medium difficulty)
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
随机推荐
How real-time cloud interaction helps the development of education industry
使用Scrcpy投屏
PostgreSQL 9.1 飞升之路
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
Comparative study of the gods in the twilight Era
Can Console. Clear be used to only clear a line instead of whole console?
c#数组补充
AI painting minimalist tutorial
Alibaba cloud award winning experience: build a highly available system with polardb-x
光环效应——谁说头上有光的就算英雄
Meituan Ali's Application Practice on multimodal recall
Apache server access log access Log settings
Two dimensional code coding theory
美团·阿里关于多模态召回的应用实践
面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
PostgreSQL 9.1 飞升之路
从0到1建设智能灰度数据体系:以vivo游戏中心为例
After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)
Agile development / agile testing experience
AI 绘画极简教程