instenceof原理

125 阅读1分钟
const myInstenceof = (child, supers) => {
  let childProto = child.__proto__
  while (true) {
    if (childProto === supers.prototype) {
      return true
    } 
    if (childProto === null) {
      return false;
    }
    return myInstenceof(childProto, supers)
  }
}