SOURCE

function myInstanceof (left, right) {
    let pt = right.prototype
    while ((left = left.__proto__)) {
        if (left === pt) {
            return true
        }
    }
    return false
}

class Person {
    constructor () {
        this.name = 'Person'
        console.log(this.name)
    }
}

let p = new Person

console.log(myInstanceof(p, Array))
console 命令行工具 X clear

                    
>
console