当前位置:网站首页>Implementation of new
Implementation of new
2022-04-23 08:05:00 【Pen drawing Acacia】
1: First, an object will be created
2: Create the properties and methods above the constructor to this object
3: Put this object's __proto__ Property of a constructor protypeof
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
</title>
<script>
// alert(2423)
// console.log("423");
function Person(name,age)
{
this.name=name;
this.age=age;
}
function _New()
{
// Create an object
const obj={};
const [Person1,...arg]=[...arguments];
// Create properties and methods in the constructor for the object
var res=Person1.apply(obj,arg);
// The display prototype of the instance points to the display prototype of the constructor
obj.__proto__=Person1.prototype;
// If the constructor has its own return value , And if it's an object, we'll use this object , Otherwise, it returns the object just created
return res==='Object'?res:obj;
}
console.log(_New(Person,' Xiao Ming ',15));
</script>
</head>
<body>
</body>
</html>
版权声明
本文为[Pen drawing Acacia]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230624332845.html
边栏推荐
- 内网渗透系列:内网隧道之dns2tcp
- KVM安装部署
- 内网渗透系列:内网隧道之icmptunnel(jamesbarlow师傅的)
- NIH降血脂指南《your guide to lowering your Cholesterol with TLC》笔记(持续更新中)
- BUUCTF [极客大挑战 2019]EasySQL1
- Research on system and software security (5)
- 数据库之Mysql——概述安装篇
- String self generated code within a given range
- Attack and defense world misc questions 1-50
- SAP TR手动导入系统操作手册
猜你喜欢
随机推荐
NLLLoss+log_SoftMax=CE_Loss
一文了解系列,对web渗透的常见漏洞总结(持续更新)
Internal network security attack and defense: a practical guide to penetration testing (8): Authority maintenance analysis and defense
攻防世界MISC刷题1-50
Ctf-misc summary
SAP自建表log功能开启
MySQL——第一章节(MySQL中的数据类型)
C # control the camera, rotate and drag the observation script (similar to scenes observation mode)
BUFFCTF文件中的秘密1
Attack and defense world misc questions 1-50
Go语学习笔记 - 异常处理 | 从零开始Go语言
MySQL -- the secret of lock -- how to lock data
Intranet penetration series: icmptunnel of Intranet tunnel (by master dhavalkapil)
C problem of marking the position of polygons surrounded by multiple rectangles
nacos源码分析思路
MySQL--锁的奥秘--数据怎么锁
STO With Billing 跨公司库存转储退货
Talk about the essence of interface idempotent and consumption idempotent
Houdini > variable building roads, learning process notes
Research on system and software security (2)







![云计算赛项--2020年赛题基础部分[任务3]](/img/a2/36ff5eafd18534207e6ab01422ea59.png)

