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
为什么要有包装对象?是为了能用.语法来读取属性、调用方法(对象才能有属性和方法),比如 "foo".length (1).toFixed(2)等代码中,都隐式的用到了包装对象。null和undefined不需要属性和方法,所以不需要包装对象。
.
"foo".length
(1).toFixed(2)
new Symbol()
new Symbol()
symbol('1').s = 1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
除了null和undefined,JS 里的原始类型都有对应的包装对象类型。
为什么要有包装对象?是为了能用
.
语法来读取属性、调用方法(对象才能有属性和方法),比如"foo".length
(1).toFixed(2)
等代码中,都隐式的用到了包装对象。null和undefined不需要属性和方法,所以不需要包装对象。symbol
new Symbol()
设计为抛出异常,而不是墨守成规的返回包装类对象new Symbol()
设计为抛出异常是因为在原型中的constructor方法中直接设计了抛出异常symbol('1').s = 1
不会报错,说明本身就是个包装类The text was updated successfully, but these errors were encountered: