赞
踩
const obj1 = {}; const obj2 = { foo: 'bar' }; Object.setPrototypeOf(obj1, obj2); const { foo } = obj1; foo // "bar"
为obj1设置原型链是obj2 obj1的foo属性找不到,就找他的原型链obj2