<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>对象</title></head><body> <script> function Person(name,age){ this.name=name; this.age=age; } var p1=new Person("zxf",30); console.log(p1.constructor.prototype) //console.log(Person.constructor) </script></body></html>
我的迷惑是为什么输出的Object的constructor是Person而不是function Object(),查阅资料上也提到了但是下面没解释为什么,说的没看懂到底在解释什么反倒最后来了句提示一定要让构造函数的原型的constructor为构造函数本身
相关分类