71.实现instanceof
webVueBlog opened this issue · 0 comments
webVueBlog commented
function myInstanceof (L, R) {
if (L === null || typeof L !== 'object' || typeof R !== 'function') {
return false;
}
let O = R.prototype;
L = Object.getPrototypeOf(L);
while(true) {
if (!L) return false;
if (O === L) return true;
L = Object.getProperty(L);
}
}