当前位置:网站首页>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 .
边栏推荐
- PostgreSQL 9.1 飞升之路
- 阿里云有奖体验:用PolarDB-X搭建一个高可用系统
- 游戏启动后提示安装HMS Core,点击取消,未再次提示安装HMS Core(初始化失败返回907135003)
- ArcGis利用栅格处理工具进行影像裁剪
- WPF double slider control and forced capture of mouse event focus
- Practice: fabric user certificate revocation operation process
- Read the BGP agreement in 6 minutes.
- AI painting minimalist tutorial
- runc hang 导致 Kubernetes 节点 NotReady
- 8 expansion sub packages! Recbole launches 2.0!
猜你喜欢

runc hang 导致 Kubernetes 节点 NotReady

Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
提高MySQL深分页查询效率的三种方案

一文掌握数仓中auto analyze的使用

光环效应——谁说头上有光的就算英雄

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

Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout

Full arrangement (medium difficulty)

实战:fabric 用户证书吊销操作流程

"Pre training weekly" issue 52: shielding visual pre training and goal-oriented dialogue
随机推荐
再说rsync+inotify实现数据的实时备份
Valentine's Day confession code
数据库锁表?别慌,本文教你如何解决
Definition of cognition
ArcGIS uses grid processing tools for image clipping
干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
Reptile exercises (I)
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
Implementation mode and technical principle of MT4 cross platform merchandising system (API merchandising, EA merchandising, nj4x Merchandising)
Use fail2ban to prevent password attempts
AI 绘画极简教程
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
使用Scrcpy投屏
上汽大通MAXUS正式发布全新品牌“MIFA”,旗舰产品MIFA 9正式亮相!
用fail2ban阻止密码尝试攻
Apache服务器访问日志access.log设置
The old-fashioned synchronized lock optimization will make it clear to you at once!
面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
爬虫练习题(一)