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

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

成都创新互联是一家专业提供陕西企业网站建设,专注与网站建设、成都做网站、成都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://bzwzjz.com/article/dsojjho.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 网站建设公司 定制网站制作 成都网站设计制作公司 重庆企业网站建设 温江网站设计 成都网站制作 成都网站建设公司 网站制作 定制级高端网站建设 宜宾网站设计 网站制作 网站设计 成都网站设计 高端网站建设 成都企业网站制作 成都网站设计 手机网站设计 H5网站制作 响应式网站设计 营销网站建设 成都网站建设 古蔺网站建设