SOURCE

//手写instanceof
function myinstanceOf_(obj,class_name){
    let proto=Object.getPrototypeOf(obj)
    let prototype=class_name.prototype
    while(true){
        if(proto==null)return false
        if(proto==prototype)return true
        proto=Object.getPrototypeOf(proto)
    }
}
var arr=[1,2]
console.log(myinstanceOf_(arr,Array))
console 命令行工具 X clear

                    
>
console