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
以下代码最终在控制台输出的结果为__________。
var a = {}, b = { name: "ping" }, c = { name: "wen" }; a[b] = 10; a[c] = 20; console.log(a[b]);
The text was updated successfully, but these errors were encountered:
为啥结果是20呢?我理解b和c都是不同的引用地址,那么作为a的key应该也是不同的,感觉a[b]等于10才说得过去呀
Sorry, something went wrong.
@MssText a[b]和a[c] 中的 b 和 c 会被类型转换成字符串,相当于调用 ({ name: "ping" }).toString(),得到 '[object Object]',两个key是相同的,所以后者会覆盖前者
@pwstrick 嗯嗯 js真是太多隐式行为了。。。。。
No branches or pull requests
以下代码最终在控制台输出的结果为__________。
The text was updated successfully, but these errors were encountered: