Student.prototype.prototype为啥不等于Pepple.prototype?

来源:5-5 instanceof 是基于原型链实现的

慕虎258424

2021-05-03

老师,Student的prototype是People,People的prototype是构造函数,那么Student.prototype.prototype为啥是undefined

写回答

2回答

双越

2021-05-03

“Student的prototype是People”—— 看似是,其实不是

//img.mukewang.com/szimg/608fd96209d9e12b05300284.jpg

1
1
慕虎258424
谢谢老师
2021-06-01
共1条回复

Best_Coder_LCN

2023-02-22

// Student.prototype 是一个object,函数才有prototype,Student.prototype.prototype 是 undefined
console.log(Student.prototype.prototype === undefined)  // true

// 你应该写
console.log(Student.prototype.__proto__ === Person.prototype)  // true


2
0

一天时间高效准备前端技术一面 匹配大厂面试要求

针对时下面试高频考点,帮助新人js面试快速通关

4694 学习 · 1681 问题

查看课程