原型&继承题目及内容解答

这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助

成都创新互联是一家专业提供陕西企业网站建设,专注与网站建设、成都做网站、成都h5网站建设、小程序制作等业务。10年已为陕西众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。

1. 代码输出结果

function Person(name) {
    this.name = name
}
var p2 = new Person('king');
console.log(p2.__proto__) //Person.prototype
console.log(p2.__proto__.__proto__) //Object.prototype
console.log(p2.__proto__.__proto__.__proto__) // null
console.log(p2.__proto__.__proto__.__proto__.__proto__)//null后面没有了,报错
console.log(p2.__proto__.__proto__.__proto__.__proto__.__proto__)//null后面没有了,报错
console.log(p2.constructor)//Person
console.log(p2.prototype)//undefined p2是实例,没有prototype属性
console.log(Person.constructor)//Function 一个空函数
console.log(Person.prototype)//打印出Person.prototype这个对象里所有的方法和属性
console.log(Person.prototype.constructor)//Person
console.log(Person.prototype.__proto__)// Object.prototype
console.log(Person.__proto__) //Function.prototype
console.log(Function.prototype.__proto__)//Object.prototype
console.log(Function.__proto__)//Function.prototype
console.log(Object.__proto__)//Function.prototype
console.log(Object.prototype.__proto__)//null

本文名称:原型&继承题目及内容解答
网站路径:http://hxwzsj.com/article/dsojjho.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 成都网站设计 攀枝花网站设计 成都网站设计 高端网站设计 高端网站设计 网站建设公司 成都网站建设 成都营销网站建设 LED网站设计方案 网站建设公司 成都网站设计 公司网站建设 成都网站建设 网站建设改版 高端品牌网站建设 成都网站建设 成都网站建设 重庆网站建设 成都网站建设 成都网站设计公司 网站建设 成都企业网站设计