关于js f1.bind(obj)返回的函数的原型对象是undefined


function f1(){
}
let obj = {name:'lisi'};
let res = f1.bind(obj);
let ob1 = new res();
console.log(ob1 instanceof res,ob1 instanceof f1,res.prototype,ob1__proto__===f1.prototype)
//true true    undefined true

res.prototype对象为undefined,照理使用instanceof就会报错,这里没报错 实例ob1还是res的实例 为什么呢 ob1原型链上根本没有res的原型

这又是如何实现的呢

function f2(){}
let ob2 = new f2();
f2.prototype = undefined;
console.log(ob2 instanceof f2)//报错语法检查右边f2的原型对象为undefined
console.log(f2.isPrototypeof(ob2))//为false


【【面试题】javascript中的原型与原型链-哔哩哔哩】 https://b23.tv/eEc2xEE