instanceof
operator
function instanceof(obj, constructor) {
//let proto = Object.getPrototypeOf(obj)
let proto = obj.__proto__;
while(proto) {
if(proto === constructor.prototype) {
return true;
}
//proto = Object.getPrototypeOf(obj)
proto = proto.__proto__;
}
return false;
}
On This Page