当前位置:网站首页>JS prototype inheritance can only inherit instances, not constructors
JS prototype inheritance can only inherit instances, not constructors
2022-07-01 09:18:00 【su27_ 0101】
js The prototype inherits the disadvantages of the constructor
- modify Person The constructor will affect the subclass that inherits it
function Person(){this.sex = 'man'};
function Man(){};
Man.prototype = Person;
var m1 = new Man();
m1.sex;//'man'
// modify Person The constructor will affect the subclass that inherits it
delete Person.sex;
m1.sex;//undefined
js Prototypes inherit constructor instances to avoid disadvantages
function Person(){this.sex = 'man'};
function Man(){};
Man.prototype = new Person();
Man.prototype.construct = Man;
var m1 = new Man();
m1.sex;//'man'
// modify Person The constructor does not affect the subclass that inherits it
delete Person.sex;
m1.sex;//'man'
边栏推荐
- 2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder
- Shell script - positional parameters (command line parameters)
- LogBack
- How to realize the usage of connecting multiple databases in idel
- Which method is good for the management of fixed assets of small and medium-sized enterprises?
- [ESP nanny level tutorial] crazy completion chapter - Case: temperature and humidity monitoring system based on Alibaba cloud, applet and Arduino
- 小鸟识别APP
- 【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
- 【pytorch】2.4 卷积函数 nn.conv2d
- Principles of Microcomputer - Introduction
猜你喜欢

Design and manufacture of simple digital display electronic scale
![[video game training] real topic of 2013 video game of infrared optical communication device](/img/ef/c2c45c1c6c24aed0a4e93101047372.png)
[video game training] real topic of 2013 video game of infrared optical communication device

Simple load balancing with Nacos

【pytorch】nn. Crossentropyloss() and nn NLLLoss()

Redis -- lattice connects to redis cluster

2.4 激活函数

2.2 【pytorch】torchvision.transforms

2.4 activation function

【pytorch】nn.CrossEntropyLoss() 与 nn.NLLLoss()

I use flask to write the website "one"
随机推荐
[pytorch] softmax function
Promise asynchronous programming
pcl_ Viewer command
Redis source code learning (29), compressed list learning, ziplist C (II)
2.4 激活函数
LogBack
Flink interview questions
Jetson Nano 安装TensorFlow GPU及问题解决
队列的实现和应用
【pytorch】transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
【pytorch】transforms. Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
Shell script - special variables: shell $, $*, [email protected], $$$
FAQ | FAQ for building applications for large screen devices
闭包实现迭代器效果
js变量提升(hoisting)
2.2 【pytorch】torchvision.transforms
2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder
JS原型链
MT7628K eCos开发入门
2.2 【pytorch】torchvision. transforms