当前位置:网站首页>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
边栏推荐
猜你喜欢

在uni-app中引入uView

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

Brain and cognitive neuroscience matlab psychoolbox cognitive science experimental design - experimental design 4

神机百炼3.53-Kruskal

Unity shader learning notes (3) URP rendering pipeline shaded PBR shader template (ASE optimized version)

Reading notes of cgnf: conditional graph neural fields

Happy Lantern Festival | Qiming cloud invites you to guess lantern riddles

测试 - 用例篇

3D printer G code command: complete list and tutorial

【C语言】简单实现扫雷游戏
随机推荐
Lantern Festival gift - plant vs zombie game (realized by Matlab)
Redis Key-Value数据库【初级】
Some experience of exercise and fitness
TI毫米波雷达学习(一)
PHP extensions
Lambda 表达式 和 方法引用
1037 Magic Coupon
php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
RGB 无限立方体(高级版)
uni-app开发中遇到的问题(持续更新)
MySQL transaction and isolation level
Some descriptions of Mipi protocol of LCD
c语言中的几个关键字
51单片机——ADC讲解(A/D转换、D/A转换)
1036 Boys vs Girls
DRM display framework as I understand it
数据库学习总结5
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
Matplotlib double Y axis + adjust legend position
php获取cpu使用率、硬盘使用、内存使用