当前位置:网站首页>Constructor in JS (emphasis)
Constructor in JS (emphasis)
2022-06-21 21:34:00 【Liujiayi_】
Constructor execution flow :
1. Create a new object immediately
2. Set the new object to the function this, You can use this To reference a new object
3. Execute the code in the function line by line
4. Return the new object as the return value
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script>
function Person() {
this.name = " Liujiayi ";
this.age = 19;
}
var P = new Person();
alert(P.name);
</script>
</body>
</html>

Use instanceof You can check whether an object is an instance of a class * grammar : object instanceof Constructors
If it is , Then return to true, Otherwise return to false
console.log(per instanceof Person);
console.log( dog instanceof Person);
* All the objects are Object The offspring of ,
* So any object and Object Left instanceof When you check, you will return true
边栏推荐
- VLAN division based on interface: static VLAN [not perfect]
- 哪些ipad的APP可以很好的阅读英文文献?
- Fm5012d small fan integrated IC scheme
- Citus 11 for Postgres 完全开源,可从任何节点查询(Citus 官方博客)
- ctfshow 105-127
- F - phone list HDU - 1671 (dictionary tree prefix)
- China micro semiconductor has passed the registration: the annual revenue is 1.1 billion, and the actual controller is New Zealand nationality
- ACM. HJ51 输出单向链表中倒数第k个结点 ●
- Installing component and package libraries in Ad
- ACM. HJ35 蛇形矩阵 ●
猜你喜欢

数据库管理:Navicat Premium 15

集群一---LVS负载均衡集群NAT模式及LVS负载均衡实战部署

30组户外旅行游玩VLOG记录LUTs调色预设Moody Travel LUTs

Scientific research cartoon | you can learn EEG by looking at the picture. Would you like to try it?

2022年最新河南建筑施工电工(建筑特种作业)模拟试题及答案

合并两个有序数组

拖延患者自救指南|“我有不拖延的100种借口,却不愿意跨出一步”

Implementation principle of global load balancing

Trend media Hypebeast plans to be listed on the curve: with a price of USD 530million, it is planned to be completed in the third quarter

基于接口划分VLAN:静态VLAN【未完善】
随机推荐
ASP. Net core creates razor page and uploads multiple files (buffer mode)
The latest simulation test questions and answers of Henan construction electrician (special construction operation) in 2022
Xcode plug-in management tool Alcatraz
集群二---LVS负载均衡群集DR模式
Lvs+keepalived high availability cluster deployment
杰理之开启四声道通话近端变调问题【篇】
ACM. HJ35 蛇形矩阵 ●
[MySQL · water drop plan] the third part - basic concepts of SQL
[server data recovery] a case of RAID5 data recovery of an EMC server
Data processing and visualization of machine learning [iris data classification | feature attribute comparison]
Number of free radical electrons and valence electrons of rdkit | molecule
自己动手写编译器:while,for,do等循环语句的中间代码生成
F - Phone List HDU - 1671 (字典树查前缀)
Dedecms dream weaving background system adds its own column menu
JS里的数据类型(基础)
Cluster I - LVS Load Balancing Cluster Nat Mode and LVS Load Balancing Field Deployment
30 groups of outdoor travel vlog record LUTS color matching preset moody travel LUTS
js的对象操作(与c的对象比较简单的多)
What plug-ins are available for vscade?
cv/nlp哪些小方向好发论文?