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
答案:三种方法(typeof、constructor、Object.prototype.toString.call())
解析:
①typeof typeof('123') === "string" // true typeof '123' === "string" // true ②constructor '123'.constructor === String // true ③Object.prototype.toString.call() Object.prototype.toString.call('123') === '[object String]' // true
The text was updated successfully, but these errors were encountered:
题目问的是如何检测一个String 类型。这里指的应该是由构造函数String生成的实例对象的类型。 let str = new String('1') typeof(str) // object 这时候用typeof 是无法判断的
Sorry, something went wrong.
漏了一种,instanceof
No branches or pull requests
答案:三种方法(typeof、constructor、Object.prototype.toString.call())
解析:
The text was updated successfully, but these errors were encountered: