当前位置:网站首页>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 .
边栏推荐
- iptables基础及Samba配置举例
- Understand bloomfilter in one article
- jsonp
- Will the concept of "being integrated" become a new inflection point of the information and innovation industry?
- Full arrangement (medium difficulty)
- 光环效应——谁说头上有光的就算英雄
- PostgreSQL 9.1 soaring Road
- A data person understands and deepens the domain model
- 【Android Kotlin】lambda的返回语句和匿名函数
- Deploy halo blog with pagoda
猜你喜欢
Detailed explanation of mt4api documentary and foreign exchange API documentary interfaces
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
Will the concept of "being integrated" become a new inflection point of the information and innovation industry?
聊聊支付流程的设计与实现逻辑
After installing vscode, the program runs (an include error is detected, please update the includepath, which has been solved for this translation unit (waveform curve is disabled) and (the source fil
AI 绘画极简教程
Zhongang Mining: in order to ensure sufficient supply of fluorite, it is imperative to open source and save flow
C#/VB.NET 给PDF文档添加文本/图像水印
Etcd storage, watch and expiration mechanism
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
随机推荐
Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
CVPR 2022 | transfusion: Lidar camera fusion for 3D target detection with transformer
面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
使用Scrcpy投屏
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
读《认知觉醒》
求解:在oracle中如何用一条语句用delete删除两个表中jack的信息
Detailed explanation of mt4api documentary and foreign exchange API documentary interfaces
8 expansion sub packages! Recbole launches 2.0!
Comparative study of the gods in the twilight Era
n++也不靠谱
「小技巧」给Seurat对象瘦瘦身
BackgroundWorker用法示例
Configure WebDAV server on Apache
N++ is not reliable
WPF double slider control and forced capture of mouse event focus
Alibaba cloud award winning experience: build a highly available system with polardb-x
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
Excuse me, have you encountered this situation? CDC 1.4 cannot use timestamp when connecting to MySQL 5.7