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

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

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

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 成都网站建设 成都响应式网站建设 成都商城网站制作 网站制作公司 重庆网站建设 阿坝网站设计 网站建设公司 四川成都网站建设 成都网站制作 手机网站建设 高端定制网站设计 重庆手机网站建设 网站设计制作 手机网站制作 盐亭网站设计 网站制作报价 成都网站设计公司 网站建设方案 外贸营销网站建设 专业网站设计 泸州网站建设 成都网站设计