当前位置:网站首页>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
边栏推荐
- Practice C language advanced address book design
- 格式校验js
- 死磕大屏UI,FineReport开发日记
- Brain and cognitive neuroscience matlab psychoolbox cognitive science experimental design - experimental design 4
- Yyds dry inventory what is test driven development
- Huawei Hongmeng OS, is it OK?
- PHP obtains some values in the string according to the specified characters, and reorganizes the remaining strings into a new array
- [PHP是否安装了 SOAP 扩]对于php实现soap代理的一个常见问题:Class ‘SoapClient‘ not found in PHP的处理方法
- "Simple" infinite magic cube
- [leetcode] day92 container with the most water
猜你喜欢

Vscode paste image plugin saves image path settings
![[paper translation] gcnet: non local networks meet squeeze exception networks and beyond](/img/7a/718162d08796f70251511101b3a61b.png)
[paper translation] gcnet: non local networks meet squeeze exception networks and beyond

"Simple" infinite magic cube

RGB infinite cube (advanced version)

【C语言】简单实现扫雷游戏

Conglin environmental protection rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, with an annual profit of more than 200million yuan

keepalived安装使用与快速入门

ROS2----LifecycleNode生命周期节点总结

TI毫米波雷达学习(一)

5g market trend in 2020
随机推荐
DRM display framework as I understand it
TI毫米波雷达学习(一)
[whether PHP has soap extensions installed] a common problem for PHP to implement soap proxy: how to handle class' SoapClient 'not found in PHP
数理统计与机器学习
External interrupts cannot be accessed. Just delete the code and restore it Record this unexpected bug
php获取cpu使用率、硬盘使用、内存使用
神机百炼3.53-Kruskal
经典文献阅读之--SuMa++
深度学习分类网络--VGGNet
Fundamentals of software testing
ES6的详细注解
keepalived安装使用与快速入门
Zabbix Server trapper 命令注入漏洞 (CVE-2017-2824)
Go learning notes integration
Conglin environmental protection rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, with an annual profit of more than 200million yuan
软件测试 - 概念篇
Error creating bean with name 'instanceoperatorclientimpl' defined in URL when Nacos starts
Some experience of exercise and fitness
token过期自动续费方案和实现
Web page user step-by-step operation guide plug-in driver js