function myInstanceof(x, fn) {
if (typeof x !== 'object') return false
let p = x.__proto__
if (p === null) return false
if (p !== fn.prototype) {
return myInstanceof(p, fn)
} else {
return true
}
}
手写instanceof
猜你喜欢
转载自blog.csdn.net/A_D_H_E_R_E/article/details/120896695
今日推荐
周排行