手写instanceof

function instanceOf(left,right) {
    let proto = left.__proto__;
    let prototype = right.prototype
    while(true) {
        if(proto === null) return false
        if(proto === prototype) return true
        proto = proto.__proto__;
    }
}

 

posted @ 2020-12-28 16:45  `Duet`  阅读(80)  评论(0编辑  收藏  举报