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
第599天 请解释下为什么下面第一种方式会报错而第二种不会?
3+1官网
我也要出题
// 第一种:构造函数创建 var object=new Object(); object.a=1; object.8=8; //Unexpected number // 第二种:字面量创建 var object = { a: 1, 8: 2 };
The text was updated successfully, but these errors were encountered:
object的键会被自动转为字符串。 但是obj.name 属性名只能是字符串,不能是数字, 因为会被当成小数点。 第一种可以使用object[8] = 8; 第二种会被转成字符串所以不会报错。
obj.name
object[8] = 8;
Sorry, something went wrong.
No branches or pull requests
第599天 请解释下为什么下面第一种方式会报错而第二种不会?
3+1官网
我也要出题
The text was updated successfully, but these errors were encountered: