手写instanceof

手写instanceof

function _instanceof(A, B) {
  let temp = B.prototype;
  let __proto__ = A.__proto__;
  while (__proto__) {
    if (__proto__ === temp) return true;
    __proto__ = __proto__.__proto__;
  }
  return false;
}