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
instanceof 运算符用来用来判断引用数据类型。
首先判断左边变量的隐式原型是否全等于右边的显示原型,相等则返回true,不相等则继续沿着原型链依次向上进行判断,最终都不相等返回false。
function instanceOf(left,right) { let proto = left.__proto__; let prototype = right.prototype while(true) { if(proto === null) return false if(proto === prototype) return true proto = proto.__proto__; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
instanceof功能
instanceof 运算符用来用来判断引用数据类型。
instanceof原理
首先判断左边变量的隐式原型是否全等于右边的显示原型,相等则返回true,不相等则继续沿着原型链依次向上进行判断,最终都不相等返回false。
模拟instanceof
The text was updated successfully, but these errors were encountered: