前端学习笔记202309学习笔记第九十三天-原型16

function test(){}
console.dir(test.__proto__===Function.prototype)
console.log(Function.__proto__===Function.prototype)
function Test1(){
    this.a=1
}
Test1.prototype.b=2
const test1=new Test1()
//test.__proto__
const testPrototype=Object.getPrototypeOf(test1)
console.log(testPrototype===test1.__proto__)
const obj={
    a:1
}
Object.setPrototypeOf(obj,{
    b:1
})
console.log(obj)

运行结果

 

posted @ 2023-09-20 08:59  前端导师歌谣  阅读(15)  评论(0)    收藏  举报  来源