We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
function myInstanceOf(L, R){ const prototype = R.prototype; let proto = Object.getPrototypeOf(L); while(true) { // 说明已经找到原型链最顶层 if(proto === null) return false; // 构造函数的原型(R.prototype)存在于实例的原型链上(L.__proto__) if(proto === prototype) return true; // 递归原型链向上查找 proto = Object.getPrototypeOf(proto); } } function C() {} function D() {} const o = new C(); console.log(myInstanceOf(o, C)); // true console.log(myInstanceOf(o, D)); // false
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: