编辑代码

function myInstanceOf(obj, target) {
    let ob = Object.getPrototypeOf(obj);
    // let ob = obj.__proto__;
    let targetPrototype = target.prototype;
    if (!targetPrototype) {
        return false;
    }
    while(ob) {
        if (ob === targetPrototype) {
            return true;
        }
        ob = Object.getPrototypeOf(ob);
    }
    return false;
}

const res = myInstanceOf([], Object);
console.log(res);