functionmyInstanceOf(object, constructor) { if (typeof object !== 'object' || object === null) returnfalse; let left = object.__proto__; let right = constructor.prototype; while (true) { // 终止条件1:找到原型了 if (left === right) returntrue; // 终止条件2:遍历到了尽头也没找到 if (left === null) returnfalse; // 还没找到:继续找呗! left = left.__proto__; }; };