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
优点:基本对于所有数据类型(基本类型、引用类型)都能判断 缺点:不能精准判断自定义对象
优点:可以弥补 Object.prototype.toString.call() 不能判断自定义对象的缺点 缺点: 1.只能用来判断引用类型,基本类型不可以 2.判断引用类型也不完全精准,只要判断对象在其类型的原型链上,就会返回true
优缺点同 instanceof
优点:基本类型和引用类型都能判断 缺点: null/undefined的值没有constructor属性,不能使用该属性判断 constructor 构造器可被修改重写
优点:基本类型和引用类型都能判断 缺点:
优点:当检测 Array 实例,Array.isArray 优于 instanceof,因为能检测 iframe 缺点:1.只能判断数组;2.兼容性差,需要 IE9+,或主流浏览器
The text was updated successfully, but these errors were encountered:
No branches or pull requests
基本类型判断
引用类型判断
数组类型判断
The text was updated successfully, but these errors were encountered: