当前位置:网站首页>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 .
边栏推荐
- Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
- 8个扩展子包!RecBole推出2.0!
- BackgroundWorker用法示例
- Is the main thread the same as the UI thread- Is main thread the same as UI thread?
- 6 分钟看完 BGP 协议。
- Master the use of auto analyze in data warehouse
- Zhongang Mining: in order to ensure sufficient supply of fluorite, it is imperative to open source and save flow
- n++也不靠谱
- Configure WebDAV server on Apache
- 【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
猜你喜欢

CTF竞赛题解之stm32逆向入门

Alibaba cloud award winning experience: build a highly available system with polardb-x

Read the BGP agreement in 6 minutes.

Comparative study of the gods in the twilight Era

诸神黄昏时代的对比学习

Full arrangement (medium difficulty)

游戏启动后提示安装HMS Core,点击取消,未再次提示安装HMS Core(初始化失败返回907135003)

Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle

DVWA range exercise 4

Will the concept of "being integrated" become a new inflection point of the information and innovation industry?
随机推荐
2022年中国移动阅读市场年度综合分析
[leetcode] 96 and 95 (how to calculate all legal BST)
Iptables foundation and Samba configuration examples
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
上汽大通MAXUS正式发布全新品牌“MIFA”,旗舰产品MIFA 9正式亮相!
[Android kotlin] lambda return statement and anonymous function
模块化笔记软件综合评测:Craft、Notion、FlowUs
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
XILINX/system-controller-c/BoardUI/无法连接开发板,任意操作后卡死的解决办法
Meituan Ali's Application Practice on multimodal recall
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
Using scrcpy projection
Alibaba cloud award winning experience: build a highly available system with polardb-x
N++ is not reliable
一个数据人对领域模型理解与深入
C#/VB.NET 给PDF文档添加文本/图像水印