我看有错--Variables in JavaScript are fundamentally 。。

本文探讨了JavaScript中变量与对象属性之间的相似性和根本差异。通过示例说明了两者虽然在语法上非常相似,但在作用域和全局变量创建方面存在区别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

4.6. Variables as Properties
You may have noticed by now that there are a lot of similarities in JavaScript between variables and the properties of objects. They are both assigned the same way, they are used the same way in JavaScript expressions, and so on. Is there really any fundamental difference between the variable i and the property i of an object o? The answer is no. Variables in JavaScript are fundamentally the same as object properties.



我认为作者整错了。起码

u.a = "1";
u = "1"

是不一样的。第二个u会成为全局的变量,而u.a不会
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值