instanceof is judged by the prototype chain, A instanceof B, layers of chain A look at the prototype, the prototype of whether there is equal B.prototype, if you have been to find the top chain of null A prototype is still not equal to B.prototype, then return false otherwise, it returns true.
function instance(left,right){ left=left.__proto__ right=right.prototype while(true){ if(left==null) return false; if(left===right) return true; left=left.__proto__ } }