当前位置:网站首页>Detailed notes of ES6
Detailed notes of ES6
2022-07-02 05:59:00 【Serena_ tz】
let
- A new way to declare variables .
- Variables cannot be declared repeatedly .
- Block level scope . in other words let Only in code blocks , Include if、else Variables in curly braces will not be defined to the global .
- No variable promotion . in other words , Using variables before declaring them will result in an error .
- Does not affect the scope chain effect . That is to say , Look up variables in functions , Function outside by let Variables defined , You can still find .
use let Achieve loop traversal . This is because it only takes effect in the block level scope .
const
Used to declare a constant , The value cannot be modified .
- Be sure to assign the initial value .
- General constants use uppercase ( Hidden rules )
- The value of a constant cannot be modified .
- Block level scope
- For the element modification of arrays and objects , It does not count as modifying constants , No mistake. .( Because the address pointed to has not changed )
Deconstruction and assignment of variables
Extract values from arrays and objects in a certain pattern .
The deconstruction of arrays
Object deconstruction
Template string
` I am also a string ~`
- Line breaks can appear directly in the content
- Variable splicing , Use
${}
Simplified writing of objects
The attribute name is the same as the attribute value. You can write only one .
Functions can also be written directly .
Arrow function
In the arrow function this Is static , Always point to... Under the scope where the function is declared this value .
Cannot be used as a constructive instance object
Out of commission arguments Variable
Shorthand for arrow function
The default value of the function parameter
After passing the parameters, we will use the passed parameters , No arguments passed in , Let's use the default value .
The default value can be used with deconstruction assignment .
You can also pass in the default value .
rest Parameters
rest Must be placed at the end of the parameter . The output is an array .
Extension operator
Symbol
Symbol Brief introduction
Summary of data types :
utilize Symbol Add properties to the object
When adding attributes to objects, we don't have to worry about naming conflicts .
Symbol Built in values
Control type detection by yourself .
Control whether the value can be expanded .
Extend the functionality of objects ~~
iterator
for of Traversal key value ,for in Traversal key name
generator
Generator is a special function , An asynchronous function , Pure callback functions .yield
It can be regarded as the cutter of function code , Every time you use a function next()
To execute the code .
for of What I'm going through is value.
Parameters of generator function
The parameter passed in will be used as the return value of the code executed once .
promise
边栏推荐
- Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond
- Can't the dist packaged by vite be opened directly in the browser
- 文件包含漏洞(二)
- 数据挖掘方向研究生常用网站
- ESP8266与STC8H8K单片机联动——天气时钟
- Test case
- 【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
- PHP read file (read the specified line containing a string in the file)
- Vite打包后的dist不能直接在浏览器打开吗
- 深度学习分类网络 -- AlexNet
猜你喜欢
OLED12864 液晶屏
Redis Key-Value数据库【初级】
PHP 开发与测试 Webservice(SOAP)-Win
Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?
测试 - 用例篇
mysql事务和隔离级别
Brain and cognitive neuroscience matlab psychoolbox cognitive science experimental design - experimental design 4
脑与认知神经科学Matlab Psytoolbox认知科学实验设计——实验设计四
How vite is compatible with lower version browsers
ROS2----LifecycleNode生命周期节点总结
随机推荐
【C语言】简单实现扫雷游戏
Software testing - concept
TI毫米波雷达学习(一)
Stc8h8k Series Assembly and c51 Real combat - NIXIE TUBE displays ADC, Key Series port reply Key number and ADC value
PHP 开发与测试 Webservice(SOAP)-Win
php内类名称与类内方法名相同
c语言中的几个关键字
File contains vulnerability (I)
PHP parent
STC8H8K系列汇编和C51实战——串口发送菜单界面选择不同功能
PHP obtains some values in the string according to the specified characters, and reorganizes the remaining strings into a new array
Redis Key-Value数据库 【秒杀】
JS determines whether the mobile terminal or the PC terminal
LCD之MIPI协议的一些说明
cookie插件和localForage离线储存插件
神机百炼3.52-Prim
DRM display framework as I understand it
Lingyunguang rushes to the scientific innovation board: the annual accounts receivable reaches 800million. Dachen and Xiaomi are shareholders
使用HBuilderX的一些常用功能
Eco express micro engine system has supported one click deployment to cloud hosting