当前位置:网站首页>ES6 knowledge points supplement
ES6 knowledge points supplement
2022-07-28 11:51:00 【The king of the scroll goes to war】
Symbol
symbol It is a kind of data type , Existing data types
Basic data type :
character string 、 Boolean 、 Numbers 、null、undefined、symbol、bigInt( Greater than 9007199254740992 Number of numbers )
Reference data type :
object ( object 、 Array 、 function ) etc.
Symbol.for() And Symbol() These two ways of writing , Will generate new Symbol
let sy = Symbol('a')
let sy1 = Symbol('a')
sy === sy1 // false
let s1 = Symbol.for('foo');
let s2 = Symbol.for('foo');
s1 === s2 // true
As can be seen above ,Symbol Even if it is the same key, The number returned is also different .
Symbol.for() Pass value It will determine whether the incoming value exists , If it doesn't exist , To return a new value .
class class
The first experience of class
class Obj {
constructor(one, two) {
this.one = one;
this.two = two;
}
hello() {
console.log("hello");
}
}
let obj = new Obj(1,2);
obj.hello();
console.log(obj);
hello
Obj {
one: 1, two: 2}
constructor ( When instantiating ), Receive the value transmitted when instantiating , And then automatically constructor In itself .
Static member of class
class Obj {
} perhaps
function Obj() {
}
Obj.name = "fujin";
let obj = new Obj();
console.log(obj); // An empty object , No attribute added
because name Only belong to Obj This class or constructor , Does not belong to instance object , This is the static member of the class , If you want to instance objects, you can use name, It can be used Obj.prototype.name= "fujin"
Again , stay class in , If you use static keyword , So long is equivalent to Obj.name = ‘fujin’
class Obj {
static name = 'fujin'
}
边栏推荐
- [applet] how to notify users of wechat applet version update?
- Outlook suddenly becomes very slow and too laggy. How to solve it
- Solutions to slow start of MATLAB
- WPF layout controls are scaled up and down with the window, which is suitable for multi-resolution full screen filling applications
- 108. Introduction to the usage of SAP ui5 image display control Avatar
- 大佬们,问下,这个不能checkpoint,因为有个jdbc的task任务状态是FINISHED,
- 【补题日记】[2022牛客暑期多校2]H-Take the Elevator
- Guys, ask me, this can't be checkpoint, because there is a JDBC task whose task status is finished,
- Left connection and right connection of MySQL (the difference between inner connection and natural connection)
- Thinkphp5 behavior hook return result (data) example
猜你喜欢

Design and implementation of SSM personal blog system

Outlook suddenly becomes very slow and too laggy. How to solve it

Zotero document manager and its use posture (updated from time to time)

14、用户web层服务(二)

Random talk on GIS data (V) - geographic coordinate system

Cvpr2020 best paper: unsupervised learning of symmetric deformable 3D objects

Digital twin rail transit: "intelligent" monitoring to clear the pain points of urban operation

Leecode8 string conversion integer (ATOI)
![[pyGame practice] when the end of the world comes, how long can you live in a cruel survival game that really starts from scratch?](/img/2b/1eb02249ab9ad0b4e1bfeeee87418c.png)
[pyGame practice] when the end of the world comes, how long can you live in a cruel survival game that really starts from scratch?

Know the optical fiber interface and supporting optical fiber cable of can optical fiber converter in fire alarm networking
随机推荐
R language - some metrics for unbalanced data sets
Left connection and right connection of MySQL (the difference between inner connection and natural connection)
1331. Array sequence number conversion
[极客大挑战 2019]BabySQL-1|SQL注入
consul安装与配置
Deployment and use of Minio distributed object storage
简单选择排序与堆排序
Flutter tutorial flutter navigator 2.0 with gorouter, use go_ Router package learn about the declarative routing mechanism in fluent (tutorial includes source code)
jar 包内文件的遍历以及文件的拷贝
ASP. Net core 6 framework unveiling example demonstration [29]: building a file server
I want to ask you guys, if there is a master-slave switch when CDC collects mysql, is there any solution
从0开发一个自己的npm包
Xiaoshuidi 2.0 website navigation network template
Shell (I)
mysql(8.0.16版)命令及说明
DNS series (III): how to avoid DNS spoofing
How to use JWT for authentication and authorization
【补题日记】[2022牛客暑期多校2]I-let fat tension
Leecode8 string conversion integer (ATOI)
Flash point list of cross platform efficiency software